Skip to content

Commit b980b45

Browse files
committed
Cleanup tutorials
1 parent 481d812 commit b980b45

File tree

18 files changed

+436
-326
lines changed

18 files changed

+436
-326
lines changed

examples/tutorials/00_sync/000_hello_acp/README.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
# [Sync] Hello ACP
22

3-
## What You'll Learn
4-
53
The simplest agent type: synchronous request/response pattern with a single `@acp.on_message_send` handler. Best for stateless operations that complete immediately.
64

7-
**When to use sync:** Quick responses, no long-running operations, no need for task management or durability.
5+
## What You'll Learn
6+
- Building a basic synchronous agent
7+
- The `@acp.on_message_send` handler pattern
8+
- When to use sync vs agentic agents
9+
10+
## Prerequisites
11+
- Development environment set up (see [main repo README](https://github.com/scaleapi/scale-agentex))
12+
- Backend services running: `make dev` from repository root
813

914
## Quick Start
1015

@@ -25,3 +30,14 @@ async def handle_message_send(params: SendMessageParams):
2530
```
2631

2732
That's it - one handler, immediate response. No task creation, no state management.
33+
34+
## When to Use
35+
- Simple chatbots with no memory requirements
36+
- Quick Q&A or information lookup agents
37+
- Prototyping and testing agent responses
38+
- Operations that complete in under a second
39+
40+
## Why This Matters
41+
Sync agents are the simplest way to get started with AgentEx. They're perfect for learning the basics and building stateless agents. Once you need conversation memory or task tracking, you'll graduate to agentic agents.
42+
43+
**Next:** [010_multiturn](../010_multiturn/) - Add conversation memory to your agent

examples/tutorials/00_sync/010_multiturn/README.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
# [Sync] Multiturn
22

3-
## What You'll Learn
3+
Handle multi-turn conversations in synchronous agents by manually maintaining conversation history and context between messages.
44

5-
Handle multi-turn conversations in synchronous agents by maintaining conversation history and context between messages.
5+
## What You'll Learn
6+
- How to handle conversation history in sync agents
7+
- Building context from previous messages
8+
- The limitations of stateless multiturn patterns
69

7-
**Use case:** Chatbots that need to reference previous messages within the same session.
10+
## Prerequisites
11+
- Development environment set up (see [main repo README](https://github.com/scaleapi/scale-agentex))
12+
- Backend services running: `make dev` from repository root
13+
- Understanding of basic sync agents (see [000_hello_acp](../000_hello_acp/))
814

915
## Quick Start
1016

@@ -36,3 +42,13 @@ async def handle_message_send(params: SendMessageParams):
3642
```
3743

3844
The handler accepts history, builds context, and returns responses that reference previous exchanges.
45+
46+
## When to Use
47+
- Simple chatbots that need conversation memory
48+
- When client can maintain and send conversation history
49+
- Quick prototypes before building full agentic agents
50+
51+
## Why This Matters
52+
While sync agents can handle conversations, you're responsible for managing state on the client side. This becomes complex quickly. For production conversational agents, consider agentic agents ([10_agentic/00_base/010_multiturn](../../10_agentic/00_base/010_multiturn/)) where the platform manages state automatically.
53+
54+
**Next:** [020_streaming](../020_streaming/) - Stream responses in real-time

examples/tutorials/00_sync/020_streaming/README.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
# [Sync] Streaming
22

3-
## What You'll Learn
4-
53
Stream responses progressively using async generators instead of returning a single message. Enables showing partial results as they're generated.
64

7-
**Use case:** LLM responses, large data processing, or any operation where you want to show progress.
5+
## What You'll Learn
6+
- How to stream responses using async generators
7+
- The `yield` pattern for progressive updates
8+
- When streaming improves user experience
9+
10+
## Prerequisites
11+
- Development environment set up (see [main repo README](https://github.com/scaleapi/scale-agentex))
12+
- Backend services running: `make dev` from repository root
13+
- Understanding of basic sync agents (see [000_hello_acp](../000_hello_acp/))
814

915
## Quick Start
1016

@@ -26,3 +32,14 @@ async def handle_message_send(params: SendMessageParams):
2632
```
2733

2834
Return an async generator instead of a single response - each `yield` sends an update to the client.
35+
36+
## When to Use
37+
- Streaming LLM responses (OpenAI, Anthropic, etc.)
38+
- Large data processing with progress updates
39+
- Any operation that takes >1 second to complete
40+
- Improving perceived responsiveness
41+
42+
## Why This Matters
43+
Streaming dramatically improves user experience for longer operations. Instead of waiting 10 seconds for a complete response, users see results immediately as they're generated. This is essential for modern AI agents.
44+
45+
**Next:** Ready for task management? → [10_agentic/00_base/000_hello_acp](../../10_agentic/00_base/000_hello_acp/)

examples/tutorials/10_agentic/00_base/000_hello_acp/README.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
# [Agentic] Hello ACP
22

3-
## What You'll Learn
4-
53
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.
64

7-
**When to use agentic:** Long-running conversations, stateful operations, or when you need task lifecycle management.
5+
## What You'll Learn
6+
- The three-handler pattern for agentic agents
7+
- How tasks differ from sync messages
8+
- When to use agentic vs sync agents
9+
10+
## Prerequisites
11+
- Development environment set up (see [main repo README](https://github.com/scaleapi/scale-agentex))
12+
- Backend services running: `make dev` from repository root
13+
- Understanding of sync agents (see [00_sync/000_hello_acp](../../../00_sync/000_hello_acp/))
814

915
## Quick Start
1016

@@ -30,3 +36,14 @@ async def handle_task_cancel(params: CancelTaskParams):
3036
```
3137

3238
Three handlers instead of one, giving you full control over task lifecycle. Tasks can receive multiple events and maintain state across them.
39+
40+
## When to Use
41+
- Conversational agents that need memory
42+
- Operations that require task tracking
43+
- Agents that need lifecycle management (initialization, cleanup)
44+
- Building towards production systems
45+
46+
## Why This Matters
47+
The task-based model is the foundation of production agents. Unlike sync agents where each message is independent, agentic agents maintain persistent tasks that can receive multiple events, store state, and have full lifecycle management. This is the stepping stone to Temporal-based agents.
48+
49+
**Next:** [010_multiturn](../010_multiturn/) - Add conversation memory
Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
# [Agentic] Multiturn
22

3-
## What You'll Learn
3+
Handle multi-turn conversations in agentic agents with task-based state management. Each task maintains its own conversation history automatically.
44

5-
Handle multi-turn conversations in agentic agents with task-based state management. Each task maintains its own conversation history.
5+
## What You'll Learn
6+
- How tasks maintain conversation state across multiple exchanges
7+
- Difference between sync and agentic multiturn patterns
8+
- Building stateful conversational agents with minimal code
69

7-
**Use case:** Conversational agents that need to remember context across multiple exchanges within a task.
10+
## Prerequisites
11+
- Development environment set up (see [main repo README](https://github.com/scaleapi/scale-agentex))
12+
- Backend services running: `make dev` from repository root
13+
- Understanding of basic agentic agents (see [000_hello_acp](../000_hello_acp/))
814

915
## Quick Start
1016

@@ -15,4 +21,41 @@ uv run agentex agents run --manifest manifest.yaml
1521

1622
## Key Pattern
1723

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.
24+
Unlike sync agents where you manually track conversation history, agentic agents automatically maintain state within each task:
25+
26+
```python
27+
@app.on_task_event_send()
28+
async def on_task_event_send(event_send: TaskEventSendInput):
29+
# The task's messages list automatically includes all previous exchanges
30+
messages = event_send.task.messages
31+
32+
# No need to manually pass history - it's already there!
33+
response = await openai_client.chat.completions.create(
34+
model="gpt-4o-mini",
35+
messages=messages
36+
)
37+
38+
return {"content": response.choices[0].message.content}
39+
```
40+
41+
## Try It
42+
43+
1. Start the agent with the command above
44+
2. Open the web UI or use the notebook to create a task
45+
3. Send multiple messages in the same task:
46+
- "What's 25 + 17?"
47+
- "What was that number again?"
48+
- "Multiply it by 2"
49+
4. Notice the agent remembers context from previous exchanges
50+
51+
## When to Use
52+
- Conversational agents that need memory across exchanges
53+
- Chat interfaces where users ask follow-up questions
54+
- Agents that build context over time within a session
55+
56+
## Why This Matters
57+
Task-based state management eliminates the complexity of manually tracking conversation history. The AgentEx platform handles state persistence automatically, making it easier to build stateful agents without custom session management code.
58+
59+
**Comparison:** In the sync version ([00_sync/010_multiturn](../../../00_sync/010_multiturn/)), you manually manage conversation history. Here, the task object does it for you.
60+
61+
**Next:** [020_streaming](../020_streaming/) - Add real-time streaming responses

examples/tutorials/10_agentic/00_base/020_streaming/README.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
# [Agentic] Streaming
22

3-
## What You'll Learn
4-
53
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.
64

7-
**Use case:** Long-running operations where you want to show progress, or multi-step processes with intermediate results.
5+
## What You'll Learn
6+
- How to stream with explicit message creation
7+
- Difference between sync and agentic streaming patterns
8+
- When to send multiple messages vs single streamed response
9+
10+
## Prerequisites
11+
- Development environment set up (see [main repo README](https://github.com/scaleapi/scale-agentex))
12+
- Backend services running: `make dev` from repository root
13+
- Understanding of agentic basics (see [000_hello_acp](../000_hello_acp/))
814

915
## Quick Start
1016

@@ -28,3 +34,14 @@ async def handle_event_send(params: SendEventParams):
2834
```
2935

3036
Unlike sync streaming (which uses async generators), agentic streaming uses explicit message creation calls, giving you more control over when and what to send.
37+
38+
## When to Use
39+
- Multi-step processes with intermediate results
40+
- Long-running operations with progress updates
41+
- Agents that need to send messages at arbitrary times
42+
- More complex streaming patterns than simple LLM responses
43+
44+
## Why This Matters
45+
Agentic streaming is more powerful than sync streaming. You can send messages at any time, from anywhere in your code, and even from background tasks. This flexibility is essential for complex agents with multiple concurrent operations.
46+
47+
**Next:** [030_tracing](../030_tracing/) - Add observability to your agents

examples/tutorials/10_agentic/00_base/030_tracing/README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
# [Agentic] Tracing
22

3-
## What You'll Learn
4-
53
Add observability to your agents with spans and traces using `adk.tracing.start_span()`. Track execution flow, measure performance, and debug complex agent behaviors.
64

7-
**Use case:** Understanding agent behavior, debugging issues, monitoring performance in production.
5+
## What You'll Learn
6+
- How to instrument agents with tracing
7+
- Creating hierarchical spans to track operations
8+
- Viewing traces in Scale Groundplane
9+
- Performance debugging with observability
10+
11+
## Prerequisites
12+
- Development environment set up (see [main repo README](https://github.com/scaleapi/scale-agentex))
13+
- Backend services running: `make dev` from repository root
14+
- Understanding of agentic agents (see [000_hello_acp](../000_hello_acp/))
815

916
## Quick Start
1017

@@ -33,3 +40,14 @@ await adk.tracing.end_span(
3340
```
3441

3542
Spans create a hierarchical view of agent execution, making it easy to see which operations take time and where errors occur.
43+
44+
## When to Use
45+
- Debugging complex agent behaviors
46+
- Performance optimization and bottleneck identification
47+
- Production monitoring and observability
48+
- Understanding execution flow in multi-step agents
49+
50+
## Why This Matters
51+
Without tracing, debugging agents is like flying blind. Tracing gives you visibility into what your agent is doing, how long operations take, and where failures occur. It's essential for production agents and invaluable during development.
52+
53+
**Next:** [040_other_sdks](../040_other_sdks/) - Integrate any SDK or framework

examples/tutorials/10_agentic/00_base/040_other_sdks/README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
# [Agentic] Other SDKs
22

3-
## What You'll Learn
4-
53
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.
64

7-
**Use case:** Using your preferred LLM provider, existing agent frameworks, or custom tooling.
5+
## What You'll Learn
6+
- How to integrate OpenAI, Anthropic, or any SDK
7+
- What AgentEx provides vs what you bring
8+
- Framework-agnostic agent development
9+
- Building agents with your preferred tools
10+
11+
## Prerequisites
12+
- Development environment set up (see [main repo README](https://github.com/scaleapi/scale-agentex))
13+
- Backend services running: `make dev` from repository root
14+
- Understanding of agentic agents (see [000_hello_acp](../000_hello_acp/))
815

916
## Quick Start
1017

@@ -25,3 +32,14 @@ You provide:
2532
- Tools and capabilities specific to your use case
2633

2734
Mix and match OpenAI, Anthropic, LangChain, or roll your own - it's all just Python.
35+
36+
## When to Use
37+
- You have an existing agent codebase to migrate
38+
- Your team prefers specific SDKs or frameworks
39+
- You need features from multiple providers
40+
- You want full control over your agent logic
41+
42+
## Why This Matters
43+
AgentEx is infrastructure, not a framework. We handle deployment, task management, and protocol implementation - you handle the agent logic with whatever tools you prefer. This keeps you flexible and avoids vendor lock-in.
44+
45+
**Next:** [080_batch_events](../080_batch_events/) - See when you need Temporal

examples/tutorials/10_agentic/00_base/080_batch_events/README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
# [Agentic] Batch Events
22

3-
## What You'll Learn
4-
53
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.
64

7-
**Problem shown:** Race conditions and ordering issues when events arrive faster than the agent can process them.
5+
## What You'll Learn
6+
- Limitations of non-Temporal agentic agents
7+
- Race conditions and ordering issues in concurrent scenarios
8+
- When you need workflow orchestration
9+
- Why this motivates Temporal adoption
10+
11+
## Prerequisites
12+
- Development environment set up (see [main repo README](https://github.com/scaleapi/scale-agentex))
13+
- Backend services running: `make dev` from repository root
14+
- Understanding of agentic patterns (see previous tutorials)
815

916
## Quick Start
1017

@@ -26,3 +33,14 @@ Then you should use Temporal workflows (see tutorials 10_agentic/10_temporal/) w
2633
- Guaranteed state consistency
2734

2835
This is the "breaking point" tutorial that motivates moving to Temporal for production agents.
36+
37+
## When to Use (This Pattern)
38+
This tutorial shows what NOT to use for production. Use base agentic agents only when:
39+
- Events are infrequent (< 1 per second)
40+
- Order doesn't matter
41+
- State consistency isn't critical
42+
43+
## Why This Matters
44+
Every production agent eventually hits concurrency issues. This tutorial shows you those limits early, so you know when to graduate to Temporal. Better to learn this lesson in a tutorial than in production!
45+
46+
**Next:** Ready for production? → [../10_temporal/000_hello_acp](../../10_temporal/000_hello_acp/) or explore [090_multi_agent_non_temporal](../090_multi_agent_non_temporal/) for complex non-Temporal coordination

examples/tutorials/10_agentic/00_base/090_multi_agent_non_temporal/README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ The system uses a shared build configuration with type-safe interfaces:
4545
## 🚀 Quick Start
4646

4747
### Prerequisites
48-
- Python 3.12+
49-
- uv package manager
48+
- Development environment set up (see [main repo README](https://github.com/scaleapi/scale-agentex))
49+
- Backend services running: `make dev` from repository root
50+
- Python 3.12+ and uv package manager
5051
- OpenAI API key (set `OPENAI_API_KEY` or create `.env` file)
52+
- Understanding of agentic patterns (see previous tutorials)
5153

5254
### Running the System
5355

@@ -195,3 +197,14 @@ This tutorial demonstrates:
195197
- **AgentEx CLI usage** for development and deployment
196198
- **Inter-agent communication patterns** with proper error handling
197199
- **Scalable agent architecture** with clear separation of concerns
200+
201+
## When to Use
202+
- Complex workflows requiring multiple specialized agents
203+
- Content pipelines with review/approval steps
204+
- Systems where each stage needs different capabilities
205+
- When you want agent separation without Temporal (though Temporal is recommended for production)
206+
207+
## Why This Matters
208+
This shows how far you can go with non-Temporal multi-agent systems. However, note the limitations: manual state management, potential race conditions, and no built-in durability. For production multi-agent systems, consider Temporal ([../10_temporal/](../../10_temporal/)) which provides workflow orchestration, durability, and state management out of the box.
209+
210+
**Next:** Ready for production workflows? → [../../10_temporal/000_hello_acp](../../10_temporal/000_hello_acp/)

0 commit comments

Comments
 (0)