concursus 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- concursus-0.1.0/LICENSE +21 -0
- concursus-0.1.0/PKG-INFO +147 -0
- concursus-0.1.0/README.md +108 -0
- concursus-0.1.0/VERSION +1 -0
- concursus-0.1.0/pyproject.toml +95 -0
- concursus-0.1.0/setup.cfg +4 -0
- concursus-0.1.0/src/concursus/__init__.py +61 -0
- concursus-0.1.0/src/concursus/cli.py +73 -0
- concursus-0.1.0/src/concursus/dag.py +119 -0
- concursus-0.1.0/src/concursus/manifest.py +110 -0
- concursus-0.1.0/src/concursus/py.typed +0 -0
- concursus-0.1.0/src/concursus.egg-info/PKG-INFO +147 -0
- concursus-0.1.0/src/concursus.egg-info/SOURCES.txt +16 -0
- concursus-0.1.0/src/concursus.egg-info/dependency_links.txt +1 -0
- concursus-0.1.0/src/concursus.egg-info/entry_points.txt +2 -0
- concursus-0.1.0/src/concursus.egg-info/requires.txt +12 -0
- concursus-0.1.0/src/concursus.egg-info/top_level.txt +1 -0
- concursus-0.1.0/tests/test_core.py +71 -0
concursus-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tianpei Xie
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
concursus-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: concursus
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Compile a declarative DAG of subagents into an orchestrated team on AWS Bedrock AgentCore.
|
|
5
|
+
Author-email: Tianpei Xie <unidoctor@gmail.com>
|
|
6
|
+
Maintainer-email: Tianpei Xie <unidoctor@gmail.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/TianpeiLuke/concursus
|
|
9
|
+
Project-URL: Repository, https://github.com/TianpeiLuke/concursus
|
|
10
|
+
Project-URL: Issues, https://github.com/TianpeiLuke/concursus/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/TianpeiLuke/concursus/blob/main/CHANGELOG.md
|
|
12
|
+
Keywords: agentcore,bedrock,aws,multi-agent,agent-orchestration,llm-agents,dag,orchestration,supervisor,mcp,a2a
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Environment :: Console
|
|
17
|
+
Classifier: Natural Language :: English
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Classifier: Topic :: System :: Distributed Computing
|
|
24
|
+
Classifier: Typing :: Typed
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: PyYAML>=6.0
|
|
29
|
+
Provides-Extra: agentcore
|
|
30
|
+
Requires-Dist: boto3>=1.34.0; extra == "agentcore"
|
|
31
|
+
Requires-Dist: bedrock-agentcore; extra == "agentcore"
|
|
32
|
+
Provides-Extra: dev
|
|
33
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
34
|
+
Requires-Dist: build>=1.0.0; extra == "dev"
|
|
35
|
+
Requires-Dist: twine>=5.0.0; extra == "dev"
|
|
36
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
37
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
|
|
40
|
+
# Concursus
|
|
41
|
+
|
|
42
|
+
[](https://opensource.org/licenses/MIT)
|
|
43
|
+
[](https://www.python.org/downloads/)
|
|
44
|
+
|
|
45
|
+
**Compile a declarative DAG of subagents into a deployed, orchestrated team on AWS Bedrock AgentCore.**
|
|
46
|
+
|
|
47
|
+
Concursus (Latin *"a running-together / convergence"*) is [cursus](https://github.com/TianpeiLuke/cursus)'s agent-orchestration sibling. Where cursus compiles a pipeline DAG + configs into a SageMaker pipeline, Concursus compiles an **AgentDAG** + per-agent `.agent.yaml` manifests into (1) an AgentCore **provisioning plan** — one `CreateAgentRuntime` per agent — and (2) a **supervisor** that dispatches the agents in topological order, wires each agent's declared output into its dependents' input, and routes shared state through AgentCore **Memory**.
|
|
48
|
+
|
|
49
|
+
It is the **coordinator AgentCore deliberately doesn't ship**: AgentCore gives you transport (A2A), tool discovery (Gateway), microVM isolation, identity, memory, and hosting — but no scheduler, dependency graph, or supervisor. You declare a DAG of agents; Concursus provisions them and runs them.
|
|
50
|
+
|
|
51
|
+
> **Status: alpha.** This release ships the **declarative core** — the backend-agnostic `AgentDAG` and the `AgentManifest` (`.agent.yaml`) model, with validation. The AgentCore provisioning plan + supervisor (the `OrchestrationAssembler`) are on the [roadmap](#roadmap).
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Installation
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install concursus # declarative core (pure Python)
|
|
59
|
+
pip install "concursus[agentcore]" # + the AWS Bedrock AgentCore runtime binding (roadmap)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Requires **Python 3.10+**.
|
|
63
|
+
|
|
64
|
+
## Quick start
|
|
65
|
+
|
|
66
|
+
Declare a team as an `AgentDAG` (nodes = agents, edges = data dependencies):
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from concursus import AgentDAG
|
|
70
|
+
|
|
71
|
+
dag = AgentDAG()
|
|
72
|
+
for agent in ["ingest", "summarize", "critique", "format"]:
|
|
73
|
+
dag.add_node(agent)
|
|
74
|
+
dag.add_edge("ingest", "summarize")
|
|
75
|
+
dag.add_edge("summarize", "critique")
|
|
76
|
+
dag.add_edge("critique", "format")
|
|
77
|
+
|
|
78
|
+
dag.topological_sort() # ['ingest', 'summarize', 'critique', 'format'] <- dispatch order
|
|
79
|
+
dag.validate() # raises if the topology has a cycle
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Describe each agent with an `.agent.yaml` manifest — its AgentCore binding + typed interface:
|
|
83
|
+
|
|
84
|
+
```yaml
|
|
85
|
+
# summarize.agent.yaml
|
|
86
|
+
registry:
|
|
87
|
+
container_uri: 111122223333.dkr.ecr.us-east-1.amazonaws.com/summarize-agent:latest
|
|
88
|
+
role_arn: arn:aws:iam::111122223333:role/ConcursusAgentRuntimeRole
|
|
89
|
+
network_mode: PUBLIC # or VPC
|
|
90
|
+
protocol: HTTP # HTTP (/invocations) | MCP (/mcp) | A2A (/)
|
|
91
|
+
qualifier: DEFAULT
|
|
92
|
+
# ...or reuse an already-deployed agent:
|
|
93
|
+
# agent_runtime_arn: arn:aws:bedrock-agentcore:us-east-1:111122223333:runtime/summarize-xyz
|
|
94
|
+
contract:
|
|
95
|
+
inputs:
|
|
96
|
+
document: {type: string}
|
|
97
|
+
outputs: # required — the dependency resolver's type gate
|
|
98
|
+
summary: {type: string}
|
|
99
|
+
key_points: {type: array, items: {type: string}}
|
|
100
|
+
spec:
|
|
101
|
+
depends_on:
|
|
102
|
+
- {from: ingest.document, to: document}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
from concursus import AgentManifest
|
|
107
|
+
|
|
108
|
+
m = AgentManifest.from_yaml("summarize.agent.yaml").validate()
|
|
109
|
+
m.protocol # 'HTTP'
|
|
110
|
+
m.output_schema # {'summary': {...}, 'key_points': {...}}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Or from the CLI:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
concursus info # overview
|
|
117
|
+
concursus validate *.agent.yaml # validate manifests
|
|
118
|
+
concursus --version
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## How it works (the compile target)
|
|
122
|
+
|
|
123
|
+
Concursus compiles `AgentDAG + manifests` through `validate → resolve → provision → assemble`, mapping cursus concepts onto AgentCore primitives:
|
|
124
|
+
|
|
125
|
+
| cursus | Concursus | AgentCore primitive |
|
|
126
|
+
|---|---|---|
|
|
127
|
+
| `PipelineDAG` | `AgentDAG` | dispatch order (topological) |
|
|
128
|
+
| `.step.yaml` | `.agent.yaml` manifest | container image + `roleArn` + protocol |
|
|
129
|
+
| `DependencyType` enum | output **JSON Schema** (mandatory) | the resolver's type gate |
|
|
130
|
+
| `PropertyReference` (deferred) | `AgentRef` (eager JSONPath) | `InvokeAgentRuntime` response |
|
|
131
|
+
| step registration | agent registration | `CreateAgentRuntime` → ARN + V1 + `DEFAULT` endpoint |
|
|
132
|
+
| `PipelineAssembler` → `Pipeline` | `OrchestrationAssembler` → supervisor + plan | `BedrockAgentCoreApp` supervisor |
|
|
133
|
+
| S3 artifact channels | shared run state | **AgentCore Memory** |
|
|
134
|
+
|
|
135
|
+
The supervisor dispatches agents in topological order, invokes each with `InvokeAgentRuntime` under one `runtimeSessionId` (session affinity → warm microVMs), extracts each producer's output by JSONPath and injects it into its consumers, and persists outputs to Memory so state survives the ephemeral microVMs.
|
|
136
|
+
|
|
137
|
+
## Roadmap
|
|
138
|
+
|
|
139
|
+
- [x] Declarative core: `AgentDAG` + `AgentManifest` (`.agent.yaml`) + validation + CLI
|
|
140
|
+
- [ ] Advisory dependency resolver over declared output JSON Schemas
|
|
141
|
+
- [ ] `OrchestrationAssembler`: emit an AgentCore provisioning plan (`CreateAgentRuntime` per agent + IAM roles + endpoints)
|
|
142
|
+
- [ ] The supervisor: topological dispatch over `InvokeAgentRuntime` with `AgentRef` wiring + Memory-backed state
|
|
143
|
+
- [ ] Gateway/A2A node types; a data-driven catalog + recommender of team topologies
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
MIT © Tianpei Xie
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Concursus
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
[](https://www.python.org/downloads/)
|
|
5
|
+
|
|
6
|
+
**Compile a declarative DAG of subagents into a deployed, orchestrated team on AWS Bedrock AgentCore.**
|
|
7
|
+
|
|
8
|
+
Concursus (Latin *"a running-together / convergence"*) is [cursus](https://github.com/TianpeiLuke/cursus)'s agent-orchestration sibling. Where cursus compiles a pipeline DAG + configs into a SageMaker pipeline, Concursus compiles an **AgentDAG** + per-agent `.agent.yaml` manifests into (1) an AgentCore **provisioning plan** — one `CreateAgentRuntime` per agent — and (2) a **supervisor** that dispatches the agents in topological order, wires each agent's declared output into its dependents' input, and routes shared state through AgentCore **Memory**.
|
|
9
|
+
|
|
10
|
+
It is the **coordinator AgentCore deliberately doesn't ship**: AgentCore gives you transport (A2A), tool discovery (Gateway), microVM isolation, identity, memory, and hosting — but no scheduler, dependency graph, or supervisor. You declare a DAG of agents; Concursus provisions them and runs them.
|
|
11
|
+
|
|
12
|
+
> **Status: alpha.** This release ships the **declarative core** — the backend-agnostic `AgentDAG` and the `AgentManifest` (`.agent.yaml`) model, with validation. The AgentCore provisioning plan + supervisor (the `OrchestrationAssembler`) are on the [roadmap](#roadmap).
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install concursus # declarative core (pure Python)
|
|
20
|
+
pip install "concursus[agentcore]" # + the AWS Bedrock AgentCore runtime binding (roadmap)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Requires **Python 3.10+**.
|
|
24
|
+
|
|
25
|
+
## Quick start
|
|
26
|
+
|
|
27
|
+
Declare a team as an `AgentDAG` (nodes = agents, edges = data dependencies):
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from concursus import AgentDAG
|
|
31
|
+
|
|
32
|
+
dag = AgentDAG()
|
|
33
|
+
for agent in ["ingest", "summarize", "critique", "format"]:
|
|
34
|
+
dag.add_node(agent)
|
|
35
|
+
dag.add_edge("ingest", "summarize")
|
|
36
|
+
dag.add_edge("summarize", "critique")
|
|
37
|
+
dag.add_edge("critique", "format")
|
|
38
|
+
|
|
39
|
+
dag.topological_sort() # ['ingest', 'summarize', 'critique', 'format'] <- dispatch order
|
|
40
|
+
dag.validate() # raises if the topology has a cycle
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Describe each agent with an `.agent.yaml` manifest — its AgentCore binding + typed interface:
|
|
44
|
+
|
|
45
|
+
```yaml
|
|
46
|
+
# summarize.agent.yaml
|
|
47
|
+
registry:
|
|
48
|
+
container_uri: 111122223333.dkr.ecr.us-east-1.amazonaws.com/summarize-agent:latest
|
|
49
|
+
role_arn: arn:aws:iam::111122223333:role/ConcursusAgentRuntimeRole
|
|
50
|
+
network_mode: PUBLIC # or VPC
|
|
51
|
+
protocol: HTTP # HTTP (/invocations) | MCP (/mcp) | A2A (/)
|
|
52
|
+
qualifier: DEFAULT
|
|
53
|
+
# ...or reuse an already-deployed agent:
|
|
54
|
+
# agent_runtime_arn: arn:aws:bedrock-agentcore:us-east-1:111122223333:runtime/summarize-xyz
|
|
55
|
+
contract:
|
|
56
|
+
inputs:
|
|
57
|
+
document: {type: string}
|
|
58
|
+
outputs: # required — the dependency resolver's type gate
|
|
59
|
+
summary: {type: string}
|
|
60
|
+
key_points: {type: array, items: {type: string}}
|
|
61
|
+
spec:
|
|
62
|
+
depends_on:
|
|
63
|
+
- {from: ingest.document, to: document}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from concursus import AgentManifest
|
|
68
|
+
|
|
69
|
+
m = AgentManifest.from_yaml("summarize.agent.yaml").validate()
|
|
70
|
+
m.protocol # 'HTTP'
|
|
71
|
+
m.output_schema # {'summary': {...}, 'key_points': {...}}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Or from the CLI:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
concursus info # overview
|
|
78
|
+
concursus validate *.agent.yaml # validate manifests
|
|
79
|
+
concursus --version
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## How it works (the compile target)
|
|
83
|
+
|
|
84
|
+
Concursus compiles `AgentDAG + manifests` through `validate → resolve → provision → assemble`, mapping cursus concepts onto AgentCore primitives:
|
|
85
|
+
|
|
86
|
+
| cursus | Concursus | AgentCore primitive |
|
|
87
|
+
|---|---|---|
|
|
88
|
+
| `PipelineDAG` | `AgentDAG` | dispatch order (topological) |
|
|
89
|
+
| `.step.yaml` | `.agent.yaml` manifest | container image + `roleArn` + protocol |
|
|
90
|
+
| `DependencyType` enum | output **JSON Schema** (mandatory) | the resolver's type gate |
|
|
91
|
+
| `PropertyReference` (deferred) | `AgentRef` (eager JSONPath) | `InvokeAgentRuntime` response |
|
|
92
|
+
| step registration | agent registration | `CreateAgentRuntime` → ARN + V1 + `DEFAULT` endpoint |
|
|
93
|
+
| `PipelineAssembler` → `Pipeline` | `OrchestrationAssembler` → supervisor + plan | `BedrockAgentCoreApp` supervisor |
|
|
94
|
+
| S3 artifact channels | shared run state | **AgentCore Memory** |
|
|
95
|
+
|
|
96
|
+
The supervisor dispatches agents in topological order, invokes each with `InvokeAgentRuntime` under one `runtimeSessionId` (session affinity → warm microVMs), extracts each producer's output by JSONPath and injects it into its consumers, and persists outputs to Memory so state survives the ephemeral microVMs.
|
|
97
|
+
|
|
98
|
+
## Roadmap
|
|
99
|
+
|
|
100
|
+
- [x] Declarative core: `AgentDAG` + `AgentManifest` (`.agent.yaml`) + validation + CLI
|
|
101
|
+
- [ ] Advisory dependency resolver over declared output JSON Schemas
|
|
102
|
+
- [ ] `OrchestrationAssembler`: emit an AgentCore provisioning plan (`CreateAgentRuntime` per agent + IAM roles + endpoints)
|
|
103
|
+
- [ ] The supervisor: topological dispatch over `InvokeAgentRuntime` with `AgentRef` wiring + Memory-backed state
|
|
104
|
+
- [ ] Gateway/A2A node types; a data-driven catalog + recommender of team topologies
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
MIT © Tianpei Xie
|
concursus-0.1.0/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.1.0
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "concursus"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Compile a declarative DAG of subagents into an orchestrated team on AWS Bedrock AgentCore."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
authors = [
|
|
12
|
+
{name = "Tianpei Xie", email = "unidoctor@gmail.com"}
|
|
13
|
+
]
|
|
14
|
+
maintainers = [
|
|
15
|
+
{name = "Tianpei Xie", email = "unidoctor@gmail.com"}
|
|
16
|
+
]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 3 - Alpha",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
|
+
"Environment :: Console",
|
|
22
|
+
"Natural Language :: English",
|
|
23
|
+
"Programming Language :: Python :: 3",
|
|
24
|
+
"Programming Language :: Python :: 3.10",
|
|
25
|
+
"Programming Language :: Python :: 3.11",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
28
|
+
"Topic :: System :: Distributed Computing",
|
|
29
|
+
"Typing :: Typed",
|
|
30
|
+
]
|
|
31
|
+
keywords = [
|
|
32
|
+
"agentcore",
|
|
33
|
+
"bedrock",
|
|
34
|
+
"aws",
|
|
35
|
+
"multi-agent",
|
|
36
|
+
"agent-orchestration",
|
|
37
|
+
"llm-agents",
|
|
38
|
+
"dag",
|
|
39
|
+
"orchestration",
|
|
40
|
+
"supervisor",
|
|
41
|
+
"mcp",
|
|
42
|
+
"a2a",
|
|
43
|
+
]
|
|
44
|
+
requires-python = ">=3.10"
|
|
45
|
+
|
|
46
|
+
# Core is pure-Python: the declarative AgentDAG + .agent.yaml manifest model.
|
|
47
|
+
dependencies = [
|
|
48
|
+
"PyYAML>=6.0",
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
[project.optional-dependencies]
|
|
52
|
+
# The AWS Bedrock AgentCore runtime binding (provisioning + invocation). Kept optional so
|
|
53
|
+
# the declarative core installs without the AWS stack.
|
|
54
|
+
agentcore = [
|
|
55
|
+
"boto3>=1.34.0",
|
|
56
|
+
"bedrock-agentcore",
|
|
57
|
+
]
|
|
58
|
+
dev = [
|
|
59
|
+
"pytest>=7.0.0",
|
|
60
|
+
"build>=1.0.0",
|
|
61
|
+
"twine>=5.0.0",
|
|
62
|
+
"black>=23.0.0",
|
|
63
|
+
"mypy>=1.0.0",
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
[project.scripts]
|
|
67
|
+
concursus = "concursus.cli:main"
|
|
68
|
+
|
|
69
|
+
[project.urls]
|
|
70
|
+
Homepage = "https://github.com/TianpeiLuke/concursus"
|
|
71
|
+
Repository = "https://github.com/TianpeiLuke/concursus"
|
|
72
|
+
Issues = "https://github.com/TianpeiLuke/concursus/issues"
|
|
73
|
+
Changelog = "https://github.com/TianpeiLuke/concursus/blob/main/CHANGELOG.md"
|
|
74
|
+
|
|
75
|
+
[tool.setuptools]
|
|
76
|
+
package-dir = {"" = "src"}
|
|
77
|
+
|
|
78
|
+
[tool.setuptools.dynamic]
|
|
79
|
+
version = {file = "VERSION"}
|
|
80
|
+
|
|
81
|
+
[tool.setuptools.packages.find]
|
|
82
|
+
where = ["src"]
|
|
83
|
+
include = ["concursus*"]
|
|
84
|
+
|
|
85
|
+
[tool.setuptools.package-data]
|
|
86
|
+
"concursus" = ["py.typed"]
|
|
87
|
+
|
|
88
|
+
[tool.black]
|
|
89
|
+
line-length = 95
|
|
90
|
+
target-version = ["py310", "py311", "py312"]
|
|
91
|
+
|
|
92
|
+
[tool.pytest.ini_options]
|
|
93
|
+
minversion = "7.0"
|
|
94
|
+
addopts = "-ra -q"
|
|
95
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""Concursus — compile a DAG of subagents into an orchestrated team on AWS Bedrock AgentCore.
|
|
2
|
+
|
|
3
|
+
Where **cursus** compiles a pipeline DAG + configs into a SageMaker pipeline, **Concursus**
|
|
4
|
+
(Latin *"a running-together / convergence"*) compiles an ``AgentDAG`` + per-agent
|
|
5
|
+
``.agent.yaml`` manifests into (1) an AgentCore provisioning plan — one ``CreateAgentRuntime``
|
|
6
|
+
per agent — and (2) a supervisor that dispatches the agents in topological order, wires each
|
|
7
|
+
agent's declared output into its dependents' input, and routes shared state through AgentCore
|
|
8
|
+
Memory. It is the coordinator AgentCore deliberately does not ship.
|
|
9
|
+
|
|
10
|
+
Status: early. This release provides the declarative core — the backend-agnostic
|
|
11
|
+
:class:`~concursus.dag.AgentDAG` and the :class:`~concursus.manifest.AgentManifest`
|
|
12
|
+
(``.agent.yaml``) model. The AgentCore provisioning plan + supervisor (the
|
|
13
|
+
``OrchestrationAssembler``) are the roadmap.
|
|
14
|
+
|
|
15
|
+
Basic usage:
|
|
16
|
+
>>> from concursus import AgentDAG
|
|
17
|
+
>>> dag = AgentDAG()
|
|
18
|
+
>>> for n in ["ingest", "summarize", "critique", "format"]:
|
|
19
|
+
... dag.add_node(n)
|
|
20
|
+
>>> dag.add_edge("ingest", "summarize").add_edge("summarize", "critique")
|
|
21
|
+
>>> dag.add_edge("critique", "format").topological_sort()
|
|
22
|
+
['ingest', 'summarize', 'critique', 'format']
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
from __future__ import annotations
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _resolve_version() -> str:
|
|
29
|
+
"""Resolve the version: a VERSION file (dev source of truth) wins over installed metadata."""
|
|
30
|
+
from pathlib import Path
|
|
31
|
+
|
|
32
|
+
version = "0.0.0"
|
|
33
|
+
try:
|
|
34
|
+
from importlib.metadata import version as _dist_version
|
|
35
|
+
|
|
36
|
+
version = _dist_version("concursus")
|
|
37
|
+
except Exception: # pragma: no cover - not installed / odd checkout
|
|
38
|
+
pass
|
|
39
|
+
_v_file = Path(__file__).resolve().parent.parent.parent / "VERSION"
|
|
40
|
+
if _v_file.exists():
|
|
41
|
+
try:
|
|
42
|
+
text = _v_file.read_text().strip()
|
|
43
|
+
if text:
|
|
44
|
+
version = text
|
|
45
|
+
except OSError:
|
|
46
|
+
pass
|
|
47
|
+
return version
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
__version__ = _resolve_version()
|
|
51
|
+
|
|
52
|
+
from .dag import AgentDAG, DAGError
|
|
53
|
+
from .manifest import AgentManifest, ManifestError
|
|
54
|
+
|
|
55
|
+
__all__ = [
|
|
56
|
+
"AgentDAG",
|
|
57
|
+
"DAGError",
|
|
58
|
+
"AgentManifest",
|
|
59
|
+
"ManifestError",
|
|
60
|
+
"__version__",
|
|
61
|
+
]
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"""The ``concursus`` command-line entry point.
|
|
2
|
+
|
|
3
|
+
Minimal for now: report the version, print an overview, and validate ``.agent.yaml``
|
|
4
|
+
manifests. The ``plan`` / ``deploy`` / ``run`` verbs (compile an AgentDAG into an AgentCore
|
|
5
|
+
provisioning plan + supervisor) are the roadmap.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import argparse
|
|
11
|
+
import sys
|
|
12
|
+
from typing import List, Optional
|
|
13
|
+
|
|
14
|
+
from . import __version__
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _cmd_info(_args: argparse.Namespace) -> int:
|
|
18
|
+
print(
|
|
19
|
+
"concursus {v}\n\n"
|
|
20
|
+
"Compile a declarative DAG of subagents into an orchestrated team on AWS Bedrock\n"
|
|
21
|
+
"AgentCore. You declare an AgentDAG (nodes = agents, edges = data dependencies) and\n"
|
|
22
|
+
"one .agent.yaml manifest per agent; Concursus provisions each agent with\n"
|
|
23
|
+
"CreateAgentRuntime and runs them with a topological supervisor over InvokeAgentRuntime,\n"
|
|
24
|
+
"wiring outputs to inputs and routing shared state through AgentCore Memory.\n\n"
|
|
25
|
+
"Status: early — this release ships the declarative core (AgentDAG + AgentManifest).\n"
|
|
26
|
+
"Roadmap: the OrchestrationAssembler (provisioning plan + supervisor).".format(
|
|
27
|
+
v=__version__
|
|
28
|
+
)
|
|
29
|
+
)
|
|
30
|
+
return 0
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _cmd_validate(args: argparse.Namespace) -> int:
|
|
34
|
+
from .manifest import AgentManifest, ManifestError
|
|
35
|
+
|
|
36
|
+
rc = 0
|
|
37
|
+
for path in args.manifests:
|
|
38
|
+
try:
|
|
39
|
+
m = AgentManifest.from_yaml(path).validate()
|
|
40
|
+
print(f"OK {path} (agent '{m.name}', protocol {m.protocol})")
|
|
41
|
+
except (ManifestError, OSError, ValueError) as exc:
|
|
42
|
+
print(f"FAIL {path} -> {exc}", file=sys.stderr)
|
|
43
|
+
rc = 1
|
|
44
|
+
return rc
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
48
|
+
p = argparse.ArgumentParser(
|
|
49
|
+
prog="concursus",
|
|
50
|
+
description="Compile a DAG of subagents into an orchestrated team on AWS Bedrock AgentCore.",
|
|
51
|
+
)
|
|
52
|
+
p.add_argument("--version", action="version", version=f"concursus {__version__}")
|
|
53
|
+
sub = p.add_subparsers(dest="command")
|
|
54
|
+
|
|
55
|
+
sub.add_parser("info", help="Print an overview of Concursus.").set_defaults(func=_cmd_info)
|
|
56
|
+
|
|
57
|
+
v = sub.add_parser("validate", help="Validate one or more .agent.yaml manifests.")
|
|
58
|
+
v.add_argument("manifests", nargs="+", help="Path(s) to .agent.yaml file(s).")
|
|
59
|
+
v.set_defaults(func=_cmd_validate)
|
|
60
|
+
|
|
61
|
+
return p
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def main(argv: Optional[List[str]] = None) -> int:
|
|
65
|
+
parser = build_parser()
|
|
66
|
+
args = parser.parse_args(argv)
|
|
67
|
+
if not getattr(args, "command", None):
|
|
68
|
+
return _cmd_info(args)
|
|
69
|
+
return int(args.func(args))
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
if __name__ == "__main__":
|
|
73
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"""The AgentDAG — a pure, backend-agnostic directed acyclic graph of agents/tasks.
|
|
2
|
+
|
|
3
|
+
Nodes are agent ids (strings); edges are data dependencies (``a -> b`` means *b depends
|
|
4
|
+
on a*). The DAG is the topology Concursus compiles into a dispatch order: a topological
|
|
5
|
+
sort gives a valid run order, independent nodes can run concurrently, and a join waits for
|
|
6
|
+
all inbound edges. This layer carries no AWS/AgentCore coupling — it is the reused core of
|
|
7
|
+
the design (the analog of cursus's ``PipelineDAG``).
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
from typing import Dict, Iterable, List, Set
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class DAGError(ValueError):
|
|
16
|
+
"""Raised on an invalid DAG (unknown node, or a cycle)."""
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class AgentDAG:
|
|
20
|
+
"""A directed acyclic graph whose nodes are agent/task ids.
|
|
21
|
+
|
|
22
|
+
Example:
|
|
23
|
+
>>> dag = AgentDAG()
|
|
24
|
+
>>> for n in ["ingest", "summarize", "critique", "format"]:
|
|
25
|
+
... dag.add_node(n)
|
|
26
|
+
>>> dag.add_edge("ingest", "summarize")
|
|
27
|
+
>>> dag.add_edge("summarize", "critique")
|
|
28
|
+
>>> dag.add_edge("critique", "format")
|
|
29
|
+
>>> dag.topological_sort()
|
|
30
|
+
['ingest', 'summarize', 'critique', 'format']
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
def __init__(self) -> None:
|
|
34
|
+
self._nodes: Set[str] = set()
|
|
35
|
+
self._edges: List[tuple] = [] # (from_node, to_node)
|
|
36
|
+
|
|
37
|
+
# -- construction -------------------------------------------------------
|
|
38
|
+
def add_node(self, name: str) -> "AgentDAG":
|
|
39
|
+
if not isinstance(name, str) or not name.strip():
|
|
40
|
+
raise DAGError("node name must be a non-empty string")
|
|
41
|
+
self._nodes.add(name)
|
|
42
|
+
return self
|
|
43
|
+
|
|
44
|
+
def add_edge(self, from_node: str, to_node: str) -> "AgentDAG":
|
|
45
|
+
"""Add a data dependency ``from_node -> to_node`` (to_node depends on from_node)."""
|
|
46
|
+
for n in (from_node, to_node):
|
|
47
|
+
if n not in self._nodes:
|
|
48
|
+
raise DAGError(f"unknown node: {n!r} (add_node first)")
|
|
49
|
+
if from_node == to_node:
|
|
50
|
+
raise DAGError(f"self-loop not allowed: {from_node!r}")
|
|
51
|
+
if (from_node, to_node) not in self._edges:
|
|
52
|
+
self._edges.append((from_node, to_node))
|
|
53
|
+
return self
|
|
54
|
+
|
|
55
|
+
# -- inspection ---------------------------------------------------------
|
|
56
|
+
@property
|
|
57
|
+
def nodes(self) -> List[str]:
|
|
58
|
+
return sorted(self._nodes)
|
|
59
|
+
|
|
60
|
+
@property
|
|
61
|
+
def edges(self) -> List[tuple]:
|
|
62
|
+
return list(self._edges)
|
|
63
|
+
|
|
64
|
+
def get_dependencies(self, node: str) -> List[str]:
|
|
65
|
+
"""Direct upstream producers of ``node``."""
|
|
66
|
+
return sorted(f for f, t in self._edges if t == node)
|
|
67
|
+
|
|
68
|
+
def get_dependents(self, node: str) -> List[str]:
|
|
69
|
+
"""Direct downstream consumers of ``node``."""
|
|
70
|
+
return sorted(t for f, t in self._edges if f == node)
|
|
71
|
+
|
|
72
|
+
def sources(self) -> List[str]:
|
|
73
|
+
"""Nodes with no dependencies (entry points)."""
|
|
74
|
+
return sorted(n for n in self._nodes if not self.get_dependencies(n))
|
|
75
|
+
|
|
76
|
+
def sinks(self) -> List[str]:
|
|
77
|
+
"""Nodes with no dependents (terminals)."""
|
|
78
|
+
return sorted(n for n in self._nodes if not self.get_dependents(n))
|
|
79
|
+
|
|
80
|
+
# -- ordering -----------------------------------------------------------
|
|
81
|
+
def topological_sort(self) -> List[str]:
|
|
82
|
+
"""Return a valid dispatch order (Kahn's algorithm). Raises on a cycle."""
|
|
83
|
+
indeg: Dict[str, int] = {n: 0 for n in self._nodes}
|
|
84
|
+
for _, t in self._edges:
|
|
85
|
+
indeg[t] += 1
|
|
86
|
+
ready = sorted(n for n, d in indeg.items() if d == 0)
|
|
87
|
+
order: List[str] = []
|
|
88
|
+
while ready:
|
|
89
|
+
n = ready.pop(0)
|
|
90
|
+
order.append(n)
|
|
91
|
+
for t in self.get_dependents(n):
|
|
92
|
+
indeg[t] -= 1
|
|
93
|
+
if indeg[t] == 0:
|
|
94
|
+
ready.append(t)
|
|
95
|
+
ready.sort()
|
|
96
|
+
if len(order) != len(self._nodes):
|
|
97
|
+
raise DAGError("DAG contains a cycle; agent topologies must be acyclic")
|
|
98
|
+
return order
|
|
99
|
+
|
|
100
|
+
def validate(self) -> "AgentDAG":
|
|
101
|
+
"""Assert the graph is a valid DAG (no cycles); returns self."""
|
|
102
|
+
self.topological_sort()
|
|
103
|
+
return self
|
|
104
|
+
|
|
105
|
+
# -- serialization ------------------------------------------------------
|
|
106
|
+
def to_dict(self) -> dict:
|
|
107
|
+
return {"nodes": self.nodes, "edges": [list(e) for e in self._edges]}
|
|
108
|
+
|
|
109
|
+
@classmethod
|
|
110
|
+
def from_dict(cls, data: dict) -> "AgentDAG":
|
|
111
|
+
dag = cls()
|
|
112
|
+
for n in data.get("nodes", []):
|
|
113
|
+
dag.add_node(n)
|
|
114
|
+
for e in data.get("edges", []):
|
|
115
|
+
dag.add_edge(e[0], e[1])
|
|
116
|
+
return dag
|
|
117
|
+
|
|
118
|
+
def __repr__(self) -> str: # pragma: no cover
|
|
119
|
+
return f"AgentDAG(nodes={len(self._nodes)}, edges={len(self._edges)})"
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"""The ``.agent.yaml`` manifest model — a single agent's interface + AgentCore binding.
|
|
2
|
+
|
|
3
|
+
An agent manifest declares three things:
|
|
4
|
+
|
|
5
|
+
- ``registry`` — how the agent is hosted on AgentCore (a container image to provision, or an
|
|
6
|
+
existing ``agent_runtime_arn`` to reuse), plus its protocol and endpoint qualifier.
|
|
7
|
+
- ``contract`` — the agent's typed interface: the input fields Concursus injects into the
|
|
8
|
+
invoke payload, and the **output JSON Schema** (required — it is the dependency resolver's
|
|
9
|
+
type gate).
|
|
10
|
+
- ``spec`` — optional author-declared edges (``depends_on``) wiring upstream outputs to this
|
|
11
|
+
agent's inputs.
|
|
12
|
+
|
|
13
|
+
This is the declarative core Concursus compiles down to ``CreateAgentRuntime`` /
|
|
14
|
+
``InvokeAgentRuntime`` calls; the runtime/assembler that consumes it is on the roadmap.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
from dataclasses import dataclass, field
|
|
20
|
+
from typing import Any, Dict, List
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class ManifestError(ValueError):
|
|
24
|
+
"""Raised on an invalid agent manifest."""
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@dataclass
|
|
28
|
+
class AgentManifest:
|
|
29
|
+
"""Parsed ``<name>.agent.yaml``.
|
|
30
|
+
|
|
31
|
+
Attributes:
|
|
32
|
+
name: The agent/node id (unique within an :class:`~concursus.dag.AgentDAG`).
|
|
33
|
+
registry: Hosting binding — e.g. ``container_uri`` + ``role_arn`` + ``network_mode``
|
|
34
|
+
+ ``protocol`` (``HTTP`` | ``MCP`` | ``A2A``) + ``qualifier``, or
|
|
35
|
+
``agent_runtime_arn`` to reuse an already-deployed runtime.
|
|
36
|
+
contract: ``{"inputs": {...}, "outputs": {<json-schema>}}``.
|
|
37
|
+
spec: Optional ``{"depends_on": [{"from": "producer.field", "to": "input"}]}``.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
name: str
|
|
41
|
+
registry: Dict[str, Any] = field(default_factory=dict)
|
|
42
|
+
contract: Dict[str, Any] = field(default_factory=dict)
|
|
43
|
+
spec: Dict[str, Any] = field(default_factory=dict)
|
|
44
|
+
|
|
45
|
+
# -- accessors ----------------------------------------------------------
|
|
46
|
+
@property
|
|
47
|
+
def protocol(self) -> str:
|
|
48
|
+
return str(self.registry.get("protocol", "HTTP")).upper()
|
|
49
|
+
|
|
50
|
+
@property
|
|
51
|
+
def inputs(self) -> Dict[str, Any]:
|
|
52
|
+
return dict(self.contract.get("inputs", {}))
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def output_schema(self) -> Dict[str, Any]:
|
|
56
|
+
return dict(self.contract.get("outputs", {}))
|
|
57
|
+
|
|
58
|
+
@property
|
|
59
|
+
def depends_on(self) -> List[Dict[str, str]]:
|
|
60
|
+
return list(self.spec.get("depends_on", []))
|
|
61
|
+
|
|
62
|
+
# -- validation ---------------------------------------------------------
|
|
63
|
+
def validate(self) -> "AgentManifest":
|
|
64
|
+
"""Enforce the manifest contract; returns self.
|
|
65
|
+
|
|
66
|
+
Rules: a name is required; the registry must name either a ``container_uri`` (to
|
|
67
|
+
provision) or an ``agent_runtime_arn`` (to reuse); and an **output schema is
|
|
68
|
+
mandatory** — it is what makes dependency resolution meaningful for agents.
|
|
69
|
+
"""
|
|
70
|
+
if not self.name or not str(self.name).strip():
|
|
71
|
+
raise ManifestError("manifest requires a non-empty 'name'")
|
|
72
|
+
reg = self.registry
|
|
73
|
+
if not (reg.get("container_uri") or reg.get("agent_runtime_arn")):
|
|
74
|
+
raise ManifestError(
|
|
75
|
+
f"{self.name}: registry must set 'container_uri' (to provision) or "
|
|
76
|
+
"'agent_runtime_arn' (to reuse an existing AgentCore Runtime)"
|
|
77
|
+
)
|
|
78
|
+
if self.protocol not in ("HTTP", "MCP", "A2A"):
|
|
79
|
+
raise ManifestError(
|
|
80
|
+
f"{self.name}: protocol must be HTTP, MCP, or A2A (got {self.protocol!r})"
|
|
81
|
+
)
|
|
82
|
+
if not self.output_schema:
|
|
83
|
+
raise ManifestError(
|
|
84
|
+
f"{self.name}: contract.outputs (a JSON Schema) is required — it is the "
|
|
85
|
+
"dependency resolver's type gate"
|
|
86
|
+
)
|
|
87
|
+
return self
|
|
88
|
+
|
|
89
|
+
# -- construction -------------------------------------------------------
|
|
90
|
+
@classmethod
|
|
91
|
+
def from_dict(cls, data: Dict[str, Any]) -> "AgentManifest":
|
|
92
|
+
return cls(
|
|
93
|
+
name=data.get("name", ""),
|
|
94
|
+
registry=dict(data.get("registry", {})),
|
|
95
|
+
contract=dict(data.get("contract", {})),
|
|
96
|
+
spec=dict(data.get("spec", {})),
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
@classmethod
|
|
100
|
+
def from_yaml(cls, path: str) -> "AgentManifest":
|
|
101
|
+
"""Load a ``.agent.yaml`` file. The name defaults to the file stem if unset."""
|
|
102
|
+
import os
|
|
103
|
+
|
|
104
|
+
import yaml # lazy: only needed when actually loading a manifest file
|
|
105
|
+
|
|
106
|
+
with open(path, "r", encoding="utf-8") as fh:
|
|
107
|
+
data = yaml.safe_load(fh) or {}
|
|
108
|
+
if not data.get("name"):
|
|
109
|
+
data["name"] = os.path.basename(path).split(".", 1)[0]
|
|
110
|
+
return cls.from_dict(data)
|
|
File without changes
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: concursus
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Compile a declarative DAG of subagents into an orchestrated team on AWS Bedrock AgentCore.
|
|
5
|
+
Author-email: Tianpei Xie <unidoctor@gmail.com>
|
|
6
|
+
Maintainer-email: Tianpei Xie <unidoctor@gmail.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/TianpeiLuke/concursus
|
|
9
|
+
Project-URL: Repository, https://github.com/TianpeiLuke/concursus
|
|
10
|
+
Project-URL: Issues, https://github.com/TianpeiLuke/concursus/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/TianpeiLuke/concursus/blob/main/CHANGELOG.md
|
|
12
|
+
Keywords: agentcore,bedrock,aws,multi-agent,agent-orchestration,llm-agents,dag,orchestration,supervisor,mcp,a2a
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Environment :: Console
|
|
17
|
+
Classifier: Natural Language :: English
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Classifier: Topic :: System :: Distributed Computing
|
|
24
|
+
Classifier: Typing :: Typed
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: PyYAML>=6.0
|
|
29
|
+
Provides-Extra: agentcore
|
|
30
|
+
Requires-Dist: boto3>=1.34.0; extra == "agentcore"
|
|
31
|
+
Requires-Dist: bedrock-agentcore; extra == "agentcore"
|
|
32
|
+
Provides-Extra: dev
|
|
33
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
34
|
+
Requires-Dist: build>=1.0.0; extra == "dev"
|
|
35
|
+
Requires-Dist: twine>=5.0.0; extra == "dev"
|
|
36
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
37
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
|
|
40
|
+
# Concursus
|
|
41
|
+
|
|
42
|
+
[](https://opensource.org/licenses/MIT)
|
|
43
|
+
[](https://www.python.org/downloads/)
|
|
44
|
+
|
|
45
|
+
**Compile a declarative DAG of subagents into a deployed, orchestrated team on AWS Bedrock AgentCore.**
|
|
46
|
+
|
|
47
|
+
Concursus (Latin *"a running-together / convergence"*) is [cursus](https://github.com/TianpeiLuke/cursus)'s agent-orchestration sibling. Where cursus compiles a pipeline DAG + configs into a SageMaker pipeline, Concursus compiles an **AgentDAG** + per-agent `.agent.yaml` manifests into (1) an AgentCore **provisioning plan** — one `CreateAgentRuntime` per agent — and (2) a **supervisor** that dispatches the agents in topological order, wires each agent's declared output into its dependents' input, and routes shared state through AgentCore **Memory**.
|
|
48
|
+
|
|
49
|
+
It is the **coordinator AgentCore deliberately doesn't ship**: AgentCore gives you transport (A2A), tool discovery (Gateway), microVM isolation, identity, memory, and hosting — but no scheduler, dependency graph, or supervisor. You declare a DAG of agents; Concursus provisions them and runs them.
|
|
50
|
+
|
|
51
|
+
> **Status: alpha.** This release ships the **declarative core** — the backend-agnostic `AgentDAG` and the `AgentManifest` (`.agent.yaml`) model, with validation. The AgentCore provisioning plan + supervisor (the `OrchestrationAssembler`) are on the [roadmap](#roadmap).
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Installation
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install concursus # declarative core (pure Python)
|
|
59
|
+
pip install "concursus[agentcore]" # + the AWS Bedrock AgentCore runtime binding (roadmap)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Requires **Python 3.10+**.
|
|
63
|
+
|
|
64
|
+
## Quick start
|
|
65
|
+
|
|
66
|
+
Declare a team as an `AgentDAG` (nodes = agents, edges = data dependencies):
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from concursus import AgentDAG
|
|
70
|
+
|
|
71
|
+
dag = AgentDAG()
|
|
72
|
+
for agent in ["ingest", "summarize", "critique", "format"]:
|
|
73
|
+
dag.add_node(agent)
|
|
74
|
+
dag.add_edge("ingest", "summarize")
|
|
75
|
+
dag.add_edge("summarize", "critique")
|
|
76
|
+
dag.add_edge("critique", "format")
|
|
77
|
+
|
|
78
|
+
dag.topological_sort() # ['ingest', 'summarize', 'critique', 'format'] <- dispatch order
|
|
79
|
+
dag.validate() # raises if the topology has a cycle
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Describe each agent with an `.agent.yaml` manifest — its AgentCore binding + typed interface:
|
|
83
|
+
|
|
84
|
+
```yaml
|
|
85
|
+
# summarize.agent.yaml
|
|
86
|
+
registry:
|
|
87
|
+
container_uri: 111122223333.dkr.ecr.us-east-1.amazonaws.com/summarize-agent:latest
|
|
88
|
+
role_arn: arn:aws:iam::111122223333:role/ConcursusAgentRuntimeRole
|
|
89
|
+
network_mode: PUBLIC # or VPC
|
|
90
|
+
protocol: HTTP # HTTP (/invocations) | MCP (/mcp) | A2A (/)
|
|
91
|
+
qualifier: DEFAULT
|
|
92
|
+
# ...or reuse an already-deployed agent:
|
|
93
|
+
# agent_runtime_arn: arn:aws:bedrock-agentcore:us-east-1:111122223333:runtime/summarize-xyz
|
|
94
|
+
contract:
|
|
95
|
+
inputs:
|
|
96
|
+
document: {type: string}
|
|
97
|
+
outputs: # required — the dependency resolver's type gate
|
|
98
|
+
summary: {type: string}
|
|
99
|
+
key_points: {type: array, items: {type: string}}
|
|
100
|
+
spec:
|
|
101
|
+
depends_on:
|
|
102
|
+
- {from: ingest.document, to: document}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
from concursus import AgentManifest
|
|
107
|
+
|
|
108
|
+
m = AgentManifest.from_yaml("summarize.agent.yaml").validate()
|
|
109
|
+
m.protocol # 'HTTP'
|
|
110
|
+
m.output_schema # {'summary': {...}, 'key_points': {...}}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Or from the CLI:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
concursus info # overview
|
|
117
|
+
concursus validate *.agent.yaml # validate manifests
|
|
118
|
+
concursus --version
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## How it works (the compile target)
|
|
122
|
+
|
|
123
|
+
Concursus compiles `AgentDAG + manifests` through `validate → resolve → provision → assemble`, mapping cursus concepts onto AgentCore primitives:
|
|
124
|
+
|
|
125
|
+
| cursus | Concursus | AgentCore primitive |
|
|
126
|
+
|---|---|---|
|
|
127
|
+
| `PipelineDAG` | `AgentDAG` | dispatch order (topological) |
|
|
128
|
+
| `.step.yaml` | `.agent.yaml` manifest | container image + `roleArn` + protocol |
|
|
129
|
+
| `DependencyType` enum | output **JSON Schema** (mandatory) | the resolver's type gate |
|
|
130
|
+
| `PropertyReference` (deferred) | `AgentRef` (eager JSONPath) | `InvokeAgentRuntime` response |
|
|
131
|
+
| step registration | agent registration | `CreateAgentRuntime` → ARN + V1 + `DEFAULT` endpoint |
|
|
132
|
+
| `PipelineAssembler` → `Pipeline` | `OrchestrationAssembler` → supervisor + plan | `BedrockAgentCoreApp` supervisor |
|
|
133
|
+
| S3 artifact channels | shared run state | **AgentCore Memory** |
|
|
134
|
+
|
|
135
|
+
The supervisor dispatches agents in topological order, invokes each with `InvokeAgentRuntime` under one `runtimeSessionId` (session affinity → warm microVMs), extracts each producer's output by JSONPath and injects it into its consumers, and persists outputs to Memory so state survives the ephemeral microVMs.
|
|
136
|
+
|
|
137
|
+
## Roadmap
|
|
138
|
+
|
|
139
|
+
- [x] Declarative core: `AgentDAG` + `AgentManifest` (`.agent.yaml`) + validation + CLI
|
|
140
|
+
- [ ] Advisory dependency resolver over declared output JSON Schemas
|
|
141
|
+
- [ ] `OrchestrationAssembler`: emit an AgentCore provisioning plan (`CreateAgentRuntime` per agent + IAM roles + endpoints)
|
|
142
|
+
- [ ] The supervisor: topological dispatch over `InvokeAgentRuntime` with `AgentRef` wiring + Memory-backed state
|
|
143
|
+
- [ ] Gateway/A2A node types; a data-driven catalog + recommender of team topologies
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
MIT © Tianpei Xie
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
VERSION
|
|
4
|
+
pyproject.toml
|
|
5
|
+
src/concursus/__init__.py
|
|
6
|
+
src/concursus/cli.py
|
|
7
|
+
src/concursus/dag.py
|
|
8
|
+
src/concursus/manifest.py
|
|
9
|
+
src/concursus/py.typed
|
|
10
|
+
src/concursus.egg-info/PKG-INFO
|
|
11
|
+
src/concursus.egg-info/SOURCES.txt
|
|
12
|
+
src/concursus.egg-info/dependency_links.txt
|
|
13
|
+
src/concursus.egg-info/entry_points.txt
|
|
14
|
+
src/concursus.egg-info/requires.txt
|
|
15
|
+
src/concursus.egg-info/top_level.txt
|
|
16
|
+
tests/test_core.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
concursus
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"""Smoke tests for the Concursus declarative core."""
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
from concursus import AgentDAG, AgentManifest, DAGError, ManifestError, __version__
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def test_version_resolves():
|
|
9
|
+
assert __version__ and __version__ != "0.0.0"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def test_dag_topological_order():
|
|
13
|
+
dag = AgentDAG()
|
|
14
|
+
for n in ["ingest", "summarize", "critique", "format"]:
|
|
15
|
+
dag.add_node(n)
|
|
16
|
+
dag.add_edge("ingest", "summarize")
|
|
17
|
+
dag.add_edge("summarize", "critique")
|
|
18
|
+
dag.add_edge("critique", "format")
|
|
19
|
+
assert dag.topological_sort() == ["ingest", "summarize", "critique", "format"]
|
|
20
|
+
assert dag.sources() == ["ingest"]
|
|
21
|
+
assert dag.sinks() == ["format"]
|
|
22
|
+
assert dag.get_dependencies("critique") == ["summarize"]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def test_dag_detects_cycle():
|
|
26
|
+
dag = AgentDAG()
|
|
27
|
+
for n in ["a", "b"]:
|
|
28
|
+
dag.add_node(n)
|
|
29
|
+
dag.add_edge("a", "b")
|
|
30
|
+
dag.add_edge("b", "a")
|
|
31
|
+
with pytest.raises(DAGError):
|
|
32
|
+
dag.topological_sort()
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def test_dag_round_trips():
|
|
36
|
+
dag = AgentDAG.from_dict({"nodes": ["a", "b"], "edges": [["a", "b"]]})
|
|
37
|
+
assert dag.to_dict() == {"nodes": ["a", "b"], "edges": [["a", "b"]]}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_dag_rejects_unknown_edge_node():
|
|
41
|
+
dag = AgentDAG().add_node("a")
|
|
42
|
+
with pytest.raises(DAGError):
|
|
43
|
+
dag.add_edge("a", "missing")
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def test_manifest_validates():
|
|
47
|
+
m = AgentManifest.from_dict(
|
|
48
|
+
{
|
|
49
|
+
"name": "summarize",
|
|
50
|
+
"registry": {"container_uri": "acct.dkr.ecr.us-east-1.amazonaws.com/x:latest",
|
|
51
|
+
"protocol": "HTTP"},
|
|
52
|
+
"contract": {"inputs": {"document": {"type": "string"}},
|
|
53
|
+
"outputs": {"summary": {"type": "string"}}},
|
|
54
|
+
}
|
|
55
|
+
).validate()
|
|
56
|
+
assert m.protocol == "HTTP"
|
|
57
|
+
assert "summary" in m.output_schema
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def test_manifest_requires_output_schema():
|
|
61
|
+
with pytest.raises(ManifestError):
|
|
62
|
+
AgentManifest.from_dict(
|
|
63
|
+
{"name": "x", "registry": {"container_uri": "y"}, "contract": {}}
|
|
64
|
+
).validate()
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def test_manifest_requires_hosting_binding():
|
|
68
|
+
with pytest.raises(ManifestError):
|
|
69
|
+
AgentManifest.from_dict(
|
|
70
|
+
{"name": "x", "contract": {"outputs": {"o": {"type": "string"}}}}
|
|
71
|
+
).validate()
|