Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ coverage:
threshold: 1%
patch:
default:
target: 80%
target: 70%
threshold: 5%

ignore:
- "**/tests/"
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 0.2.0 - Execution Semantics Profile (ESP)

- **New**: Execution Semantics Profile (ESP) defines execution semantics for ADP agents
- Flow graph execution model (node readiness, edge traversal, state passing)
- State model with core fields (`inputs`, `context`, `memory`, `tool_responses`)
- Tool binding semantics via `tool_ref` field
- Model and prompt reference resolution
- Error and failure semantics (permanent vs transient)
- **New**: `flow.graph.nodes[].tool_ref` field for explicit tool binding
- **New**: `runtime.models[]` array for explicit model configuration
- **Enhanced**: Conformance requirements for ESP-conformant runners
- **Backward compatible**: All ADP v0.1.0 manifests remain valid

## 0.1.0 - Initial draft

- Introduced ADP, ACS, and ADPKG specifications (v0.1).
Expand Down
53 changes: 53 additions & 0 deletions fixtures/adp_v0.2.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
adp_version: "0.2.0"
id: "fixture.acme.v0.2.0"
name: "ACME Agent v0.2.0 with ESP features"
runtime:
execution:
- backend: "python"
id: "py"
entrypoint: "agent.main:app"
models:
- id: "primary"
provider: "openai"
model: "gpt-4"
api_key_env: "OPENAI_API_KEY"
flow:
id: "fixture.flow.v0.2.0"
graph:
nodes:
- id: "input"
kind: "input"
- id: "llm-node"
kind: "llm"
model_ref: "primary"
system_prompt_ref: "prompts.system"
prompt_ref: "prompts.user"
- id: "tool-node"
kind: "tool"
tool_ref: "metrics-api"
- id: "output"
kind: "output"
edges:
- { from: "input", to: "llm-node" }
- { from: "llm-node", to: "tool-node" }
- { from: "tool-node", to: "output" }
start_nodes: ["input"]
end_nodes: ["output"]
prompts:
system: "You are a helpful assistant."
user: "Answer the user's question."
tools:
http_apis:
- id: "metrics-api"
description: "Metrics API"
base_url: "https://api.example.com"
evaluation:
suites:
- id: "suite1"
metrics:
- id: "m1"
type: "deterministic"
function: "noop"
scoring: "boolean"
threshold: true

4 changes: 2 additions & 2 deletions schemas/adp.schema.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/schemas/adp.schema.json",
"title": "Agent Definition Protocol v0.1.0",
"title": "Agent Definition Protocol v0.2.0",
"type": "object",
"required": ["adp_version", "id", "runtime", "flow", "evaluation"],
"properties": {
"adp_version": {"type": "string", "const": "0.1.0"},
"adp_version": {"type": "string", "enum": ["0.1.0", "0.2.0"]},
"id": {"type": "string", "minLength": 1},
"name": {"type": "string"},
"description": {"type": "string"},
Expand Down
4 changes: 3 additions & 1 deletion schemas/flow.schema.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/schemas/flow.schema.json",
"title": "AFG Flow v0.1",
"title": "AFG Flow v0.2",
"type": "object",
"required": ["id", "graph"],
"properties": {
Expand Down Expand Up @@ -69,6 +69,8 @@
"label": {"type": "string"},
"model_ref": {"type": "string"},
"system_prompt_ref": {"type": "string"},
"prompt_ref": {"type": "string"},
"tool_ref": {"type": "string", "description": "References a tool ID from tools.* arrays (v0.2.0+)"},
"strategy": {"type": "string"},
"params": {"type": "object", "additionalProperties": true},
"ui": {"$ref": "#/definitions/ui"},
Expand Down
23 changes: 22 additions & 1 deletion schemas/runtime.schema.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/schemas/runtime.schema.json",
"title": "ADP Runtime v0.1.0",
"title": "ADP Runtime v0.2.0",
"type": "object",
"required": ["execution"],
"properties": {
"execution": {
"type": "array",
"minItems": 1,
"items": {"$ref": "#/definitions/backend"}
},
"models": {
"type": "array",
"description": "Model configurations for LLM nodes (v0.2.0+)",
"items": {"$ref": "#/definitions/model"},
"minItems": 0
}
},
"additionalProperties": false,
Expand Down Expand Up @@ -141,6 +147,21 @@
"then": {"required": ["type", "endpoint"]}
}
]
},
"model": {
"type": "object",
"required": ["id", "provider", "model"],
"properties": {
"id": {"type": "string", "minLength": 1},
"provider": {"type": "string"},
"model": {"type": "string"},
"api_key_env": {"type": "string"},
"base_url": {"type": "string", "format": "uri"},
"temperature": {"type": "number"},
"max_tokens": {"type": "integer"},
"extensions": {"type": "object", "additionalProperties": true}
},
"additionalProperties": false
}
}
}
12 changes: 12 additions & 0 deletions sdk/go/adp/adp.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,20 @@ type RuntimeEntry struct {
Entrypoint string `yaml:"entrypoint"`
}

type Model struct {
ID string `yaml:"id"`
Provider string `yaml:"provider"`
Model string `yaml:"model"`
APIKeyEnv string `yaml:"api_key_env,omitempty"`
BaseURL string `yaml:"base_url,omitempty"`
Temperature *float64 `yaml:"temperature,omitempty"`
MaxTokens *int `yaml:"max_tokens,omitempty"`
Extensions map[string]interface{} `yaml:"extensions,omitempty"`
}

type Runtime struct {
Execution []RuntimeEntry `yaml:"execution"`
Models []Model `yaml:"models,omitempty"`
}

type ADP struct {
Expand Down
44 changes: 43 additions & 1 deletion sdk/go/adp/adp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func TestValidateADPEmptyID(t *testing.T) {

func TestValidateADPInvalidVersion(t *testing.T) {
adp := &ADP{
ADPVersion: "0.2.0",
ADPVersion: "0.3.0", // Invalid version (not 0.1.0 or 0.2.0)
ID: "test",
Runtime: Runtime{Execution: []RuntimeEntry{{Backend: "python", ID: "py", Entrypoint: "main:app"}}},
Flow: map[string]interface{}{},
Expand All @@ -115,6 +115,48 @@ func TestValidateADPInvalidVersion(t *testing.T) {
}
}

func TestValidateADPV0_2_0(t *testing.T) {
adp := &ADP{
ADPVersion: "0.2.0",
ID: "agent.v0.2.0",
Runtime: Runtime{
Execution: []RuntimeEntry{{Backend: "python", ID: "py", Entrypoint: "main:app"}},
Models: []Model{
{
ID: "primary",
Provider: "openai",
Model: "gpt-4",
APIKeyEnv: "OPENAI_API_KEY",
},
},
},
Flow: map[string]interface{}{
"id": "test.flow",
"graph": map[string]interface{}{
"nodes": []map[string]interface{}{
{"id": "input", "kind": "input"},
{"id": "llm", "kind": "llm", "model_ref": "primary"},
{"id": "tool", "kind": "tool", "tool_ref": "api"},
{"id": "output", "kind": "output"},
},
"edges": []interface{}{},
"start_nodes": []string{"input"},
"end_nodes": []string{"output"},
},
},
Evaluation: map[string]interface{}{},
}
if err := ValidateADP(adp); err != nil {
t.Fatalf("unexpected validation error for v0.2.0: %v", err)
}
if len(adp.Runtime.Models) != 1 {
t.Errorf("expected 1 model, got %d", len(adp.Runtime.Models))
}
if adp.Runtime.Models[0].ID != "primary" {
t.Errorf("expected model ID 'primary', got '%s'", adp.Runtime.Models[0].ID)
}
}

func TestValidateADPMultipleBackends(t *testing.T) {
adp := &ADP{
ADPVersion: "0.1.0",
Expand Down
5 changes: 3 additions & 2 deletions sdk/go/adp/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package adp
import "fmt"

func ValidateADP(_adp *ADP) error {
if _adp.ADPVersion != "0.1.0" {
return fmt.Errorf("adp_version must be 0.1.0")
// Allow both v0.1.0 and v0.2.0
if _adp.ADPVersion != "0.1.0" && _adp.ADPVersion != "0.2.0" {
return fmt.Errorf("adp_version must be 0.1.0 or 0.2.0, got %s", _adp.ADPVersion)
}
if len(_adp.Runtime.Execution) == 0 {
return fmt.Errorf("runtime.execution must not be empty")
Expand Down
15 changes: 12 additions & 3 deletions sdk/go/adpkg/adpkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ func CreateADPKG(srcDir, outPath string) error {
if err := createTar(layerTar, srcDir); err != nil {
return err
}
layerBytes, _ := os.ReadFile(layerTar)
layerBytes, err := os.ReadFile(layerTar)
if err != nil {
return err
}
layerDigest := sha256Bytes(layerBytes)
if err := writeBlob(outPath, layerDigest, layerBytes); err != nil {
return err
Expand All @@ -70,7 +73,10 @@ func CreateADPKG(srcDir, outPath string) error {
},
},
}
manifestBytes, _ := json.MarshalIndent(manifest, "", " ")
manifestBytes, err := json.MarshalIndent(manifest, "", " ")
if err != nil {
return err
}
manifestDigest := sha256Bytes(manifestBytes)
if err := writeBlob(outPath, manifestDigest, manifestBytes); err != nil {
return err
Expand All @@ -89,7 +95,10 @@ func CreateADPKG(srcDir, outPath string) error {
},
},
}
indexBytes, _ := json.MarshalIndent(index, "", " ")
indexBytes, err := json.MarshalIndent(index, "", " ")
if err != nil {
return err
}
if err := os.WriteFile(filepath.Join(outPath, "index.json"), indexBytes, 0o644); err != nil {
return err
}
Expand Down
Loading
Loading