Skip to content

Commit e677b31

Browse files
committed
Cleanup the readmes
1 parent 6735ccc commit e677b31

File tree

16 files changed

+449
-921
lines changed

16 files changed

+449
-921
lines changed
Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
11
# [Sync] Hello ACP
22

3-
This is a simple AgentEx agent that just says hello and acknowledges the user's message to show which ACP methods need to be implemented for the sync ACP type.
3+
## What You'll Learn
44

5-
## Official Documentation
5+
The simplest agent type: synchronous request/response pattern with a single `@acp.on_message_send` handler. Best for stateless operations that complete immediately.
66

7-
[000 Hello ACP](https://dev.agentex.scale.com/docs/tutorials/sync/000_hello_acp)
7+
**When to use sync:** Quick responses, no long-running operations, no need for task management or durability.
8+
9+
## Quick Start
10+
11+
```bash
12+
cd examples/tutorials/00_sync/000_hello_acp
13+
uv run agentex agents run --manifest manifest.yaml
14+
```
15+
16+
## Key Code
17+
18+
```python
19+
@acp.on_message_send
20+
async def handle_message_send(params: SendMessageParams):
21+
return TextContent(
22+
author="agent",
23+
content=f"Echo: {params.content.content}"
24+
)
25+
```
26+
27+
That's it - one handler, immediate response. No task creation, no state management.
Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,38 @@
11
# [Sync] Multiturn
22

3-
This tutorial demonstrates how to handle multiturn conversations in AgentEx agents using the Agent 2 Client Protocol (ACP).
3+
## What You'll Learn
44

5-
## Official Documentation
5+
Handle multi-turn conversations in synchronous agents by maintaining conversation history and context between messages.
66

7-
[010 Multiturn](https://dev.agentex.scale.com/docs/tutorials/sync/010_multiturn)
7+
**Use case:** Chatbots that need to reference previous messages within the same session.
8+
9+
## Quick Start
10+
11+
```bash
12+
cd examples/tutorials/00_sync/010_multiturn
13+
uv run agentex agents run --manifest manifest.yaml
14+
```
15+
16+
## Key Pattern
17+
18+
Sync agents are stateless by default. To handle multi-turn conversations, you need to:
19+
1. Accept conversation history in the request
20+
2. Maintain context across messages
21+
3. Return responses that build on previous exchanges
22+
23+
```python
24+
@acp.on_message_send
25+
async def handle_message_send(params: SendMessageParams):
26+
# Accept conversation history from client
27+
history = params.conversation_history
28+
29+
# Build context from history
30+
context = build_context(history)
31+
32+
# Generate response considering full context
33+
response = generate_response(params.content, context)
34+
35+
return TextContent(author="agent", content=response)
36+
```
37+
38+
The handler accepts history, builds context, and returns responses that reference previous exchanges.
Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,28 @@
11
# [Sync] Streaming
22

3-
This tutorial demonstrates how to implement streaming responses in AgentEx agents using the Agent 2 Client Protocol (ACP).
3+
## What You'll Learn
44

5-
## Official Documentation
5+
Stream responses progressively using async generators instead of returning a single message. Enables showing partial results as they're generated.
66

7-
[020 Streaming](https://dev.agentex.scale.com/docs/tutorials/sync/020_streaming)
7+
**Use case:** LLM responses, large data processing, or any operation where you want to show progress.
88

9+
## Quick Start
910

11+
```bash
12+
cd examples/tutorials/00_sync/020_streaming
13+
uv run agentex agents run --manifest manifest.yaml
14+
```
15+
16+
## Key Code
17+
18+
```python
19+
@acp.on_message_send
20+
async def handle_message_send(params: SendMessageParams):
21+
async def stream_response():
22+
for chunk in response_chunks:
23+
yield TaskMessageUpdate(content=TextContent(...))
24+
25+
return stream_response()
26+
```
27+
28+
Return an async generator instead of a single response - each `yield` sends an update to the client.
Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,32 @@
11
# [Agentic] Hello ACP
22

3-
This tutorial demonstrates how to implement the base agentic ACP type in AgentEx agents.
3+
## What You'll Learn
44

5-
## Official Documentation
5+
Agentic agents use three handlers for async task management: `on_task_create`, `on_task_event_send`, and `on_task_cancel`. Unlike sync agents, tasks persist and can receive multiple events over time.
66

7-
[000 Hello Base Agentic](https://dev.agentex.scale.com/docs/tutorials/agentic/base/hello_acp/)
7+
**When to use agentic:** Long-running conversations, stateful operations, or when you need task lifecycle management.
8+
9+
## Quick Start
10+
11+
```bash
12+
cd examples/tutorials/10_agentic/00_base/000_hello_acp
13+
uv run agentex agents run --manifest manifest.yaml
14+
```
15+
16+
## Key Pattern
17+
18+
```python
19+
@acp.on_task_create
20+
async def handle_task_create(params: CreateTaskParams):
21+
# Initialize task state, send welcome message
22+
23+
@acp.on_task_event_send
24+
async def handle_event_send(params: SendEventParams):
25+
# Handle each message/event in the task
26+
27+
@acp.on_task_cancel
28+
async def handle_task_cancel(params: CancelTaskParams):
29+
# Cleanup when task is cancelled
30+
```
31+
32+
Three handlers instead of one, giving you full control over task lifecycle. Tasks can receive multiple events and maintain state across them.
Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
# [Agentic] Multiturn
22

3-
This tutorial demonstrates how to handle multiturn conversations in AgentEx agents using the agentic ACP type.
3+
## What You'll Learn
44

5-
## Official Documentation
5+
Handle multi-turn conversations in agentic agents with task-based state management. Each task maintains its own conversation history.
66

7-
[010 Multiturn Base Agentic](https://dev.agentex.scale.com/docs/tutorials/agentic/base/multiturn/)
7+
**Use case:** Conversational agents that need to remember context across multiple exchanges within a task.
8+
9+
## Quick Start
10+
11+
```bash
12+
cd examples/tutorials/10_agentic/00_base/010_multiturn
13+
uv run agentex agents run --manifest manifest.yaml
14+
```
15+
16+
## Key Pattern
17+
18+
In sync agents, you manually pass conversation history. In agentic agents, the task itself maintains state across multiple `on_task_event_send` calls, making it easier to build stateful conversations.
Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,30 @@
11
# [Agentic] Streaming
22

3-
This tutorial demonstrates how to implement streaming responses in AgentEx agents using the agentic ACP type.
3+
## What You'll Learn
44

5-
## Official Documentation
5+
Stream responses in agentic agents using `adk.messages.create()` to send progressive updates. More flexible than sync streaming since you can send multiple messages at any time.
66

7-
[020 Streaming Base Agentic](https://dev.agentex.scale.com/docs/tutorials/agentic/base/streaming/)
7+
**Use case:** Long-running operations where you want to show progress, or multi-step processes with intermediate results.
8+
9+
## Quick Start
10+
11+
```bash
12+
cd examples/tutorials/10_agentic/00_base/020_streaming
13+
uv run agentex agents run --manifest manifest.yaml
14+
```
15+
16+
## Key Pattern
17+
18+
```python
19+
@acp.on_task_event_send
20+
async def handle_event_send(params: SendEventParams):
21+
# Send first message
22+
await adk.messages.create(task_id=task_id, content=...)
23+
24+
# Do work...
25+
26+
# Send second message
27+
await adk.messages.create(task_id=task_id, content=...)
28+
```
29+
30+
Unlike sync streaming (which uses async generators), agentic streaming uses explicit message creation calls, giving you more control over when and what to send.
Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,35 @@
11
# [Agentic] Tracing
22

3-
This tutorial demonstrates how to implement hierarchical and custom tracing in AgentEx agents using the agentic ACP type.
3+
## What You'll Learn
44

5-
## Official Documentation
5+
Add observability to your agents with spans and traces using `adk.tracing.start_span()`. Track execution flow, measure performance, and debug complex agent behaviors.
66

7-
[030 Tracing Base Agentic](https://dev.agentex.scale.com/docs/tutorials/agentic/base/tracing/)
7+
**Use case:** Understanding agent behavior, debugging issues, monitoring performance in production.
8+
9+
## Quick Start
10+
11+
```bash
12+
cd examples/tutorials/10_agentic/00_base/030_tracing
13+
uv run agentex agents run --manifest manifest.yaml
14+
```
15+
16+
## Key Pattern
17+
18+
```python
19+
# Start a span to track an operation
20+
span = await adk.tracing.start_span(
21+
trace_id=task.id,
22+
name="LLM Call",
23+
input={"prompt": prompt}
24+
)
25+
26+
# Do work...
27+
28+
# End span with output
29+
await adk.tracing.end_span(
30+
span_id=span.id,
31+
output={"response": response}
32+
)
33+
```
34+
35+
Spans create a hierarchical view of agent execution, making it easy to see which operations take time and where errors occur.
Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
11
# [Agentic] Other SDKs
22

3-
This tutorial demonstrates how to use other SDKs in AgentEx agents to show the flexibility that agents are just code.
3+
## What You'll Learn
44

5-
## Official Documentation
5+
Agents are just Python code - integrate any SDK you want (OpenAI, Anthropic, LangChain, LlamaIndex, custom libraries, etc.). AgentEx doesn't lock you into a specific framework.
66

7-
[040 Other SDKs Base Agentic](https://dev.agentex.scale.com/docs/tutorials/agentic/base/other_sdks/)
7+
**Use case:** Using your preferred LLM provider, existing agent frameworks, or custom tooling.
8+
9+
## Quick Start
10+
11+
```bash
12+
cd examples/tutorials/10_agentic/00_base/040_other_sdks
13+
uv run agentex agents run --manifest manifest.yaml
14+
```
15+
16+
## Key Insight
17+
18+
AgentEx provides:
19+
- ACP protocol implementation (task management, message handling)
20+
- Deployment infrastructure
21+
- Monitoring and observability
22+
23+
You provide:
24+
- Agent logic using whatever SDK/library you want
25+
- Tools and capabilities specific to your use case
26+
27+
Mix and match OpenAI, Anthropic, LangChain, or roll your own - it's all just Python.
Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,28 @@
11
# [Agentic] Batch Events
22

3-
This tutorial demonstrates batch event processing and the limitations of the base agentic ACP protocol.
3+
## What You'll Learn
44

5-
## Official Documentation
5+
Demonstrates limitations of the base agentic protocol with concurrent event processing. When multiple events arrive rapidly, base agentic agents handle them sequentially, which can cause issues.
66

7-
[080 Batch Events Base Agentic](https://dev.agentex.scale.com/docs/tutorials/agentic/base/batch_events/)
7+
**Problem shown:** Race conditions and ordering issues when events arrive faster than the agent can process them.
8+
9+
## Quick Start
10+
11+
```bash
12+
cd examples/tutorials/10_agentic/00_base/080_batch_events
13+
uv run agentex agents run --manifest manifest.yaml
14+
```
15+
16+
## Why This Matters
17+
18+
This tutorial shows **when you need Temporal**. If your agent needs to:
19+
- Handle events that might arrive out of order
20+
- Process multiple events in parallel safely
21+
- Maintain consistent state under concurrent load
22+
23+
Then you should use Temporal workflows (see tutorials 10_agentic/10_temporal/) which provide:
24+
- Deterministic event ordering
25+
- Safe concurrent processing
26+
- Guaranteed state consistency
27+
28+
This is the "breaking point" tutorial that motivates moving to Temporal for production agents.
Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,41 @@
1-
# [Agentic] Hello ACP with Temporal
1+
# [Temporal] Hello ACP
22

3-
This tutorial demonstrates how to implement the agentic ACP type with Temporal workflows in AgentEx agents.
3+
## What You'll Learn
44

5-
## Official Documentation
5+
Temporal workflows make agents durable - they survive restarts and can run indefinitely without consuming resources while idle. Instead of handlers, you define a workflow class with `@workflow.run` and `@workflow.signal` methods.
66

7-
[000 Hello Temporal Agentic](https://dev.agentex.scale.com/docs/tutorials/agentic/temporal/hello_acp/)
7+
**When to use Temporal:** Production agents that need guaranteed execution, long-running tasks (hours/days/weeks), or operations that must survive system failures.
8+
9+
**Coming from base agentic?** See tutorial `080_batch_events` to understand when you need Temporal.
10+
11+
## Quick Start
12+
13+
```bash
14+
cd examples/tutorials/10_agentic/10_temporal/000_hello_acp
15+
uv run agentex agents run --manifest manifest.yaml
16+
```
17+
18+
**Monitor:** Check Temporal UI at http://localhost:8080 to see your durable workflow running.
19+
20+
## Key Pattern
21+
22+
```python
23+
@workflow.defn(name="my-workflow")
24+
class MyWorkflow(BaseWorkflow):
25+
@workflow.run
26+
async def on_task_create(self, params: CreateTaskParams):
27+
# Wait indefinitely for events - workflow stays alive
28+
await workflow.wait_condition(lambda: self._complete)
29+
30+
@workflow.signal(name=SignalName.RECEIVE_EVENT)
31+
async def on_task_event_send(self, params: SendEventParams):
32+
# Handle events as signals to the workflow
33+
```
34+
35+
## Why This Matters
36+
37+
**Without Temporal:** If your worker crashes, the agent loses all state and has to start over.
38+
39+
**With Temporal:** The workflow resumes exactly where it left off. If it crashes mid-conversation, Temporal brings it back up with full context intact. Can run for years if needed, only consuming resources when actively processing.
40+
41+
This is the foundation for production-ready agents that handle real-world reliability requirements.

0 commit comments

Comments
 (0)