diff --git a/examples/tutorials/00_sync/000_hello_acp/manifest.yaml b/examples/tutorials/00_sync/000_hello_acp/manifest.yaml index efb2fd78..8d9de0c8 100644 --- a/examples/tutorials/00_sync/000_hello_acp/manifest.yaml +++ b/examples/tutorials/00_sync/000_hello_acp/manifest.yaml @@ -61,7 +61,7 @@ agent: # Type of ACP to use # sync: Simple synchronous ACP implementation - # agentic: Advanced ACP with sub-types "base" or "temporal" (requires config) + # async: Asynchronous, non-blocking ACP implementation acp_type: sync # Description of what your agent does diff --git a/examples/tutorials/10_async/00_base/000_hello_acp/README.md b/examples/tutorials/10_async/00_base/000_hello_acp/README.md index efe2a6fb..ba8aece1 100644 --- a/examples/tutorials/10_async/00_base/000_hello_acp/README.md +++ b/examples/tutorials/10_async/00_base/000_hello_acp/README.md @@ -44,6 +44,6 @@ Three handlers instead of one, giving you full control over task lifecycle. Task - Building towards production systems ## Why This Matters -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. +The task-based model is the foundation of production agents. Unlike sync agents where each message is independent, async 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. **Next:** [010_multiturn](../010_multiturn/) - Add conversation memory diff --git a/examples/tutorials/10_async/00_base/000_hello_acp/manifest.yaml b/examples/tutorials/10_async/00_base/000_hello_acp/manifest.yaml index 12a99bcf..47ee7c25 100644 --- a/examples/tutorials/10_async/00_base/000_hello_acp/manifest.yaml +++ b/examples/tutorials/10_async/00_base/000_hello_acp/manifest.yaml @@ -106,7 +106,7 @@ deployment: global: agent: name: "ab000-hello-acp" - description: "An AgentEx agent that is not intelligent. It just shows how to implement the base agentic ACP type." + description: "An AgentEx agent that is not intelligent. It just shows how to implement the base async ACP type." # Default replica count replicaCount: 1 diff --git a/examples/tutorials/10_async/00_base/010_multiturn/README.md b/examples/tutorials/10_async/00_base/010_multiturn/README.md index 6c7b3a4f..e16b96c7 100644 --- a/examples/tutorials/10_async/00_base/010_multiturn/README.md +++ b/examples/tutorials/10_async/00_base/010_multiturn/README.md @@ -1,27 +1,27 @@ -# [Agentic] Multiturn +# [Async] Multiturn -Handle multi-turn conversations in agentic agents with task-based state management. Each task maintains its own conversation history automatically. +Handle multi-turn conversations in async agents with task-based state management. Each task maintains its own conversation history automatically. ## What You'll Learn - How tasks maintain conversation state across multiple exchanges -- Difference between sync and agentic multiturn patterns +- Difference between sync and async multiturn patterns - Building stateful conversational agents with minimal code ## Prerequisites - Development environment set up (see [main repo README](https://github.com/scaleapi/scale-agentex)) - Backend services running: `make dev` from repository root -- Understanding of basic agentic agents (see [000_hello_acp](../000_hello_acp/)) +- Understanding of basic async agents (see [000_hello_acp](../000_hello_acp/)) ## Quick Start ```bash -cd examples/tutorials/10_agentic/00_base/010_multiturn +cd examples/tutorials/10_async/00_base/010_multiturn uv run agentex agents run --manifest manifest.yaml ``` ## Key Pattern -Unlike sync agents where you manually track conversation history, agentic agents automatically maintain state within each task: +Unlike sync agents where you manually track conversation history, async agents automatically maintain state within each task: ```python @app.on_task_event_send() diff --git a/examples/tutorials/10_async/00_base/010_multiturn/dev.ipynb b/examples/tutorials/10_async/00_base/010_multiturn/dev.ipynb index 1694e293..e174e470 100644 --- a/examples/tutorials/10_async/00_base/010_multiturn/dev.ipynb +++ b/examples/tutorials/10_async/00_base/010_multiturn/dev.ipynb @@ -29,7 +29,7 @@ "metadata": {}, "outputs": [], "source": [ - "# (REQUIRED) Create a new task. For Agentic agents, you must create a task for messages to be associated with.\n", + "# (REQUIRED) Create a new task. For Async agents, you must create a task for messages to be associated with.\n", "import uuid\n", "\n", "rpc_response = client.agents.create_task(\n", diff --git a/examples/tutorials/10_async/00_base/020_streaming/README.md b/examples/tutorials/10_async/00_base/020_streaming/README.md index 43026b42..17c19b57 100644 --- a/examples/tutorials/10_async/00_base/020_streaming/README.md +++ b/examples/tutorials/10_async/00_base/020_streaming/README.md @@ -1,21 +1,21 @@ # [Agentic] Streaming -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. +Stream responses in async agents using `adk.messages.create()` to send progressive updates. More flexible than sync streaming since you can send multiple messages at any time. ## What You'll Learn - How to stream with explicit message creation -- Difference between sync and agentic streaming patterns +- Difference between sync and async streaming patterns - When to send multiple messages vs single streamed response ## Prerequisites - Development environment set up (see [main repo README](https://github.com/scaleapi/scale-agentex)) - Backend services running: `make dev` from repository root -- Understanding of agentic basics (see [000_hello_acp](../000_hello_acp/)) +- Understanding of async basics (see [000_hello_acp](../000_hello_acp/)) ## Quick Start ```bash -cd examples/tutorials/10_agentic/00_base/020_streaming +cd examples/tutorials/10_async/00_base/020_streaming uv run agentex agents run --manifest manifest.yaml ``` @@ -33,7 +33,7 @@ async def handle_event_send(params: SendEventParams): await adk.messages.create(task_id=task_id, content=...) ``` -Unlike sync streaming (which uses async generators), agentic streaming uses explicit message creation calls, giving you more control over when and what to send. +Unlike sync streaming (which uses async generators), async streaming uses explicit message creation calls, giving you more control over when and what to send. ## When to Use - Multi-step processes with intermediate results diff --git a/examples/tutorials/10_async/00_base/030_tracing/README.md b/examples/tutorials/10_async/00_base/030_tracing/README.md index 8a67c5dc..1d91f565 100644 --- a/examples/tutorials/10_async/00_base/030_tracing/README.md +++ b/examples/tutorials/10_async/00_base/030_tracing/README.md @@ -11,12 +11,12 @@ Add observability to your agents with spans and traces using `adk.tracing.start_ ## Prerequisites - Development environment set up (see [main repo README](https://github.com/scaleapi/scale-agentex)) - Backend services running: `make dev` from repository root -- Understanding of agentic agents (see [000_hello_acp](../000_hello_acp/)) +- Understanding of async agents (see [000_hello_acp](../000_hello_acp/)) ## Quick Start ```bash -cd examples/tutorials/10_agentic/00_base/030_tracing +cd examples/tutorials/10_async/00_base/030_tracing uv run agentex agents run --manifest manifest.yaml ``` diff --git a/examples/tutorials/10_async/00_base/040_other_sdks/README.md b/examples/tutorials/10_async/00_base/040_other_sdks/README.md index 7234f3d6..5c086233 100644 --- a/examples/tutorials/10_async/00_base/040_other_sdks/README.md +++ b/examples/tutorials/10_async/00_base/040_other_sdks/README.md @@ -11,12 +11,12 @@ Agents are just Python code - integrate any SDK you want (OpenAI, Anthropic, Lan ## Prerequisites - Development environment set up (see [main repo README](https://github.com/scaleapi/scale-agentex)) - Backend services running: `make dev` from repository root -- Understanding of agentic agents (see [000_hello_acp](../000_hello_acp/)) +- Understanding of async agents (see [000_hello_acp](../000_hello_acp/)) ## Quick Start ```bash -cd examples/tutorials/10_agentic/00_base/040_other_sdks +cd examples/tutorials/10_async/00_base/040_other_sdks uv run agentex agents run --manifest manifest.yaml ``` diff --git a/examples/tutorials/10_async/00_base/080_batch_events/README.md b/examples/tutorials/10_async/00_base/080_batch_events/README.md index 7a2efce3..b49e0187 100644 --- a/examples/tutorials/10_async/00_base/080_batch_events/README.md +++ b/examples/tutorials/10_async/00_base/080_batch_events/README.md @@ -1,9 +1,9 @@ # [Agentic] Batch Events -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. +Demonstrates limitations of the base async protocol with concurrent event processing. When multiple events arrive rapidly, base async agents handle them sequentially, which can cause issues. ## What You'll Learn -- Limitations of non-Temporal agentic agents +- Limitations of non-Temporal async agents - Race conditions and ordering issues in concurrent scenarios - When you need workflow orchestration - Why this motivates Temporal adoption @@ -11,12 +11,12 @@ Demonstrates limitations of the base agentic protocol with concurrent event proc ## Prerequisites - Development environment set up (see [main repo README](https://github.com/scaleapi/scale-agentex)) - Backend services running: `make dev` from repository root -- Understanding of agentic patterns (see previous tutorials) +- Understanding of async patterns (see previous tutorials) ## Quick Start ```bash -cd examples/tutorials/10_agentic/00_base/080_batch_events +cd examples/tutorials/10_async/00_base/080_batch_events uv run agentex agents run --manifest manifest.yaml ``` @@ -27,7 +27,7 @@ This tutorial shows **when you need Temporal**. If your agent needs to: - Process multiple events in parallel safely - Maintain consistent state under concurrent load -Then you should use Temporal workflows (see tutorials 10_agentic/10_temporal/) which provide: +Then you should use Temporal workflows (see tutorials 10_async/10_temporal/) which provide: - Deterministic event ordering - Safe concurrent processing - Guaranteed state consistency @@ -35,7 +35,7 @@ Then you should use Temporal workflows (see tutorials 10_agentic/10_temporal/) w This is the "breaking point" tutorial that motivates moving to Temporal for production agents. ## When to Use (This Pattern) -This tutorial shows what NOT to use for production. Use base agentic agents only when: +This tutorial shows what NOT to use for production. Use base async agents only when: - Events are infrequent (< 1 per second) - Order doesn't matter - State consistency isn't critical diff --git a/examples/tutorials/10_async/00_base/090_multi_agent_non_temporal/README.md b/examples/tutorials/10_async/00_base/090_multi_agent_non_temporal/README.md index 476b75ee..d9f860e3 100644 --- a/examples/tutorials/10_async/00_base/090_multi_agent_non_temporal/README.md +++ b/examples/tutorials/10_async/00_base/090_multi_agent_non_temporal/README.md @@ -49,13 +49,13 @@ The system uses a shared build configuration with type-safe interfaces: - Backend services running: `make dev` from repository root - Python 3.12+ and uv package manager - OpenAI API key (set `OPENAI_API_KEY` or create `.env` file) -- Understanding of agentic patterns (see previous tutorials) +- Understanding of async patterns (see previous tutorials) ### Running the System 1. **Start all agents**: ```bash - cd examples/tutorials/10_agentic/00_base/090_multi_agent_non_temporal + cd examples/tutorials/10_async/00_base/090_multi_agent_non_temporal ./start-agents.sh start ``` diff --git a/examples/tutorials/10_async/00_base/090_multi_agent_non_temporal/start-agents.sh b/examples/tutorials/10_async/00_base/090_multi_agent_non_temporal/start-agents.sh index cef1a5ce..78346363 100755 --- a/examples/tutorials/10_async/00_base/090_multi_agent_non_temporal/start-agents.sh +++ b/examples/tutorials/10_async/00_base/090_multi_agent_non_temporal/start-agents.sh @@ -18,7 +18,7 @@ CRITIC_PORT=8002 FORMATTER_PORT=8003 # Base directory -BASE_DIR="examples/tutorials/10_agentic/00_base/090_multi_agent_non_temporal" +BASE_DIR="examples/tutorials/10_async/00_base/090_multi_agent_non_temporal" echo -e "${BLUE}🎭 Multi-Agent Content Assembly Line (Flattened)${NC}" echo -e "${BLUE}===============================================${NC}" diff --git a/examples/tutorials/10_async/10_temporal/000_hello_acp/README.md b/examples/tutorials/10_async/10_temporal/000_hello_acp/README.md index 6a5431f5..95d8f852 100644 --- a/examples/tutorials/10_async/10_temporal/000_hello_acp/README.md +++ b/examples/tutorials/10_async/10_temporal/000_hello_acp/README.md @@ -6,18 +6,18 @@ Temporal workflows make agents durable - they survive restarts and can run indef - Building durable agents with Temporal workflows - The workflow and signal pattern - How workflows survive failures and resume automatically -- When to use Temporal vs base agentic agents +- When to use Temporal vs base async agents ## Prerequisites - Development environment set up (see [main repo README](https://github.com/scaleapi/scale-agentex)) - Backend services running: `make dev` from repository root (includes Temporal) - Temporal UI available at http://localhost:8233 -- Understanding of base agentic agents (see [../../00_base/080_batch_events](../../00_base/080_batch_events/) to understand why Temporal) +- Understanding of base async agents (see [../../00_base/080_batch_events](../../00_base/080_batch_events/) to understand why Temporal) ## Quick Start ```bash -cd examples/tutorials/10_agentic/10_temporal/000_hello_acp +cd examples/tutorials/10_async/10_temporal/000_hello_acp uv run agentex agents run --manifest manifest.yaml ``` diff --git a/examples/tutorials/10_async/10_temporal/010_agent_chat/README.md b/examples/tutorials/10_async/10_temporal/010_agent_chat/README.md index 4707472c..37c31f13 100644 --- a/examples/tutorials/10_async/10_temporal/010_agent_chat/README.md +++ b/examples/tutorials/10_async/10_temporal/010_agent_chat/README.md @@ -17,7 +17,7 @@ Combine streaming responses, multi-turn chat, tool calling, and tracing - all wi ## Quick Start ```bash -cd examples/tutorials/10_agentic/10_temporal/010_agent_chat +cd examples/tutorials/10_async/10_temporal/010_agent_chat uv run agentex agents run --manifest manifest.yaml ``` @@ -33,7 +33,7 @@ uv run agentex agents run --manifest manifest.yaml ## Key Insight -In base agentic agents, all this state lives in memory and is lost on crash. With Temporal, the entire conversation - history, tool calls, intermediate state - is durably persisted. The agent can pick up a conversation that paused days ago as if no time passed. +In base async agents, all this state lives in memory and is lost on crash. With Temporal, the entire conversation - history, tool calls, intermediate state - is durably persisted. The agent can pick up a conversation that paused days ago as if no time passed. ## When to Use - Production chatbots with tool capabilities diff --git a/examples/tutorials/10_async/10_temporal/010_agent_chat/project/workflow.py b/examples/tutorials/10_async/10_temporal/010_agent_chat/project/workflow.py index 1ad2388c..ed2ec85b 100644 --- a/examples/tutorials/10_async/10_temporal/010_agent_chat/project/workflow.py +++ b/examples/tutorials/10_async/10_temporal/010_agent_chat/project/workflow.py @@ -234,7 +234,7 @@ async def on_task_event_send(self, params: SendEventParams) -> None: "to provide accurate and well-reasoned responses." ), parent_span_id=span.id if span else None, - model="gpt-5-mini", + model="gpt-4o-mini", model_settings=ModelSettings( # Include reasoning items in the response (IDs, summaries) # response_include=["reasoning.encrypted_content"], diff --git a/examples/tutorials/10_async/10_temporal/010_agent_chat/tests/test_agent.py b/examples/tutorials/10_async/10_temporal/010_agent_chat/tests/test_agent.py index 4a81b99e..bd1f8426 100644 --- a/examples/tutorials/10_async/10_temporal/010_agent_chat/tests/test_agent.py +++ b/examples/tutorials/10_async/10_temporal/010_agent_chat/tests/test_agent.py @@ -7,7 +7,7 @@ - Multi-turn conversations with state management - Tool usage (calculator and web search via MCP) -Key differences from base agentic (040_other_sdks): +Key differences from base async (040_other_sdks): 1. Temporal Integration: Uses Temporal workflows for durable execution 2. State Management: State is managed within the workflow instance 3. No Race Conditions: Temporal ensures sequential event processing diff --git a/examples/tutorials/10_async/10_temporal/020_state_machine/README.md b/examples/tutorials/10_async/10_temporal/020_state_machine/README.md index 05e0fe1c..49814000 100644 --- a/examples/tutorials/10_async/10_temporal/020_state_machine/README.md +++ b/examples/tutorials/10_async/10_temporal/020_state_machine/README.md @@ -17,7 +17,7 @@ Build complex multi-state workflows using state machines with Temporal. This tut ## Quick Start ```bash -cd examples/tutorials/10_agentic/10_temporal/020_state_machine +cd examples/tutorials/10_async/10_temporal/020_state_machine uv run agentex agents run --manifest manifest.yaml ``` diff --git a/examples/tutorials/10_async/10_temporal/020_state_machine/manifest.yaml b/examples/tutorials/10_async/10_temporal/020_state_machine/manifest.yaml index 613d7550..892df29f 100644 --- a/examples/tutorials/10_async/10_temporal/020_state_machine/manifest.yaml +++ b/examples/tutorials/10_async/10_temporal/020_state_machine/manifest.yaml @@ -73,7 +73,7 @@ agent: # Description of what your agent does # Helps with documentation and discovery - description: An AgentEx agentthat demonstrates how to uose state machines to manage complex agentic workflows + description: An AgentEx agentthat demonstrates how to uose state machines to manage complex async workflows # Temporal workflow configuration # This enables your agent to run as a Temporal workflow for long-running tasks @@ -122,7 +122,7 @@ deployment: global: agent: name: "at020-state-machine" - description: "An AgentEx agentthat demonstrates how to uose state machines to manage complex agentic workflows" + description: "An AgentEx agentthat demonstrates how to uose state machines to manage complex async workflows" # Default replica count replicaCount: 1 diff --git a/examples/tutorials/10_async/10_temporal/020_state_machine/pyproject.toml b/examples/tutorials/10_async/10_temporal/020_state_machine/pyproject.toml index 7e49622c..e018b322 100644 --- a/examples/tutorials/10_async/10_temporal/020_state_machine/pyproject.toml +++ b/examples/tutorials/10_async/10_temporal/020_state_machine/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "hatchling.build" [project] name = "at020-state-machine" version = "0.1.0" -description = "An AgentEx agentthat demonstrates how to uose state machines to manage complex agentic workflows" +description = "An AgentEx agentthat demonstrates how to uose state machines to manage complex async workflows" readme = "README.md" requires-python = ">=3.12" dependencies = [ diff --git a/examples/tutorials/10_async/10_temporal/030_custom_activities/README.md b/examples/tutorials/10_async/10_temporal/030_custom_activities/README.md index 92aa8a03..28a08c21 100644 --- a/examples/tutorials/10_async/10_temporal/030_custom_activities/README.md +++ b/examples/tutorials/10_async/10_temporal/030_custom_activities/README.md @@ -18,7 +18,7 @@ Learn how to extend Temporal workflows with custom activities for external opera **Terminal 1 - Start Worker:** ```bash -cd examples/tutorials/10_agentic/10_temporal/030_custom_activities +cd examples/tutorials/10_async/10_temporal/030_custom_activities uv run python project/run_worker.py ``` diff --git a/examples/tutorials/10_async/10_temporal/050_agent_chat_guardrails/README.md b/examples/tutorials/10_async/10_temporal/050_agent_chat_guardrails/README.md index 8f6d3bc1..b6e192b5 100644 --- a/examples/tutorials/10_async/10_temporal/050_agent_chat_guardrails/README.md +++ b/examples/tutorials/10_async/10_temporal/050_agent_chat_guardrails/README.md @@ -17,7 +17,7 @@ This tutorial demonstrates how to implement streaming multiturn tool-enabled cha ## Quick Start ```bash -cd examples/tutorials/10_agentic/10_temporal/050_agent_chat_guardrails +cd examples/tutorials/10_async/10_temporal/050_agent_chat_guardrails uv run agentex agents run --manifest manifest.yaml ``` diff --git a/examples/tutorials/10_async/10_temporal/050_agent_chat_guardrails/project/acp.py b/examples/tutorials/10_async/10_temporal/050_agent_chat_guardrails/project/acp.py index 2e069423..744068d7 100644 --- a/examples/tutorials/10_async/10_temporal/050_agent_chat_guardrails/project/acp.py +++ b/examples/tutorials/10_async/10_temporal/050_agent_chat_guardrails/project/acp.py @@ -5,7 +5,7 @@ # Create the ACP server acp = FastACP.create( - acp_type="agentic", + acp_type="async", config=TemporalACPConfig( # When deployed to the cluster, the Temporal address will automatically be set to the cluster address # For local development, we set the address manually to talk to the local Temporal service set up via docker compose diff --git a/examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/dev.ipynb b/examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/dev.ipynb index 04aa5cb9..ae143b89 100644 --- a/examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/dev.ipynb +++ b/examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/dev.ipynb @@ -18,9 +18,7 @@ "id": "d1c309d6", "metadata": {}, "outputs": [], - "source": [ - "AGENT_NAME = \"example-tutorial\"" - ] + "source": "AGENT_NAME = \"at060-open-ai-agents-sdk-hello-world\"" }, { "cell_type": "code", diff --git a/examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/manifest.yaml b/examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/manifest.yaml index f43b7ba7..b5da9121 100644 --- a/examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/manifest.yaml +++ b/examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/manifest.yaml @@ -69,7 +69,7 @@ agent: # Unique name for your agent # Used for task routing and monitoring - name: example-tutorial + name: at060-open-ai-agents-sdk-hello-world # Description of what your agent does # Helps with documentation and discovery @@ -82,12 +82,12 @@ agent: workflows: # Name of the workflow class # Must match the @workflow.defn name in your workflow.py - - name: example-tutorial + - name: at060-open-ai-agents-sdk-hello-world # Queue name for task distribution # Used by Temporal to route tasks to your agent # Convention: _task_queue - queue_name: example_tutorial_queue + queue_name: at060_open_ai_agents_sdk_hello_world_queue # Optional: Credentials mapping # Maps Kubernetes secrets to environment variables @@ -102,10 +102,10 @@ agent: # Optional: Set Environment variables for running your agent locally as well # as for deployment later on - env: - OPENAI_API_KEY: "" + env: {} + # OPENAI_API_KEY: "" # OPENAI_BASE_URL: "" - OPENAI_ORG_ID: "" + # OPENAI_ORG_ID: "" # Deployment Configuration @@ -124,7 +124,7 @@ deployment: # These can be overridden using --override-file with custom configuration files global: agent: - name: "example-tutorial" + name: "at060-open-ai-agents-sdk-hello-world" description: "An AgentEx agent" # Default replica count @@ -137,4 +137,4 @@ deployment: memory: "1Gi" limits: cpu: "1000m" - memory: "2Gi" \ No newline at end of file + memory: "2Gi" diff --git a/examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/project/run_worker.py b/examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/project/run_worker.py index 7e1702f5..70886a54 100644 --- a/examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/project/run_worker.py +++ b/examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/project/run_worker.py @@ -2,7 +2,7 @@ from temporalio.contrib.openai_agents import OpenAIAgentsPlugin -from project.workflow import ExampleTutorialWorkflow +from project.workflow import At060OpenAiAgentsSdkHelloWorldWorkflow from agentex.lib.utils.debug import setup_debug_if_enabled from agentex.lib.utils.logging import make_logger from agentex.lib.environment_variables import EnvironmentVariables @@ -62,7 +62,7 @@ async def main(): await worker.run( activities=all_activities, - workflow=ExampleTutorialWorkflow, + workflow=At060OpenAiAgentsSdkHelloWorldWorkflow, ) if __name__ == "__main__": diff --git a/examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/project/workflow.py b/examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/project/workflow.py index 8b5e9de9..650c3674 100644 --- a/examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/project/workflow.py +++ b/examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/project/workflow.py @@ -78,7 +78,7 @@ class StateModel(BaseModel): @workflow.defn(name=environment_variables.WORKFLOW_NAME) -class ExampleTutorialWorkflow(BaseWorkflow): +class At060OpenAiAgentsSdkHelloWorldWorkflow(BaseWorkflow): """ Hello World Temporal Workflow with OpenAI Agents SDK Integration diff --git a/examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/pyproject.toml b/examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/pyproject.toml index 57c46347..5a1cd08d 100644 --- a/examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/pyproject.toml +++ b/examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/pyproject.toml @@ -3,14 +3,14 @@ requires = ["hatchling"] build-backend = "hatchling.build" [project] -name = "example_tutorial" +name = "at060_open_ai_agents_sdk_hello_world" version = "0.1.0" description = "An AgentEx agent" requires-python = ">=3.12" dependencies = [ - "agentex-sdk==0.6.0", - "openai-agents-sdk==0.4.2", - "temporalio==1.18.2", + "agentex-sdk>=0.6.0", + "openai-agents>=0.4.2", + "temporalio>=1.18.2", "scale-gp", ] @@ -32,4 +32,4 @@ target-version = ['py312'] [tool.isort] profile = "black" -line_length = 88 \ No newline at end of file +line_length = 88 diff --git a/examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/tests/test_agent.py b/examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/tests/test_agent.py index 46a0a9a7..d571e0e7 100644 --- a/examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/tests/test_agent.py +++ b/examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/tests/test_agent.py @@ -20,7 +20,7 @@ import pytest import pytest_asyncio -from test_utils.agentic import ( +from test_utils.async_utils import ( poll_messages, send_event_and_poll_yielding, ) @@ -31,7 +31,7 @@ # Configuration from environment variables AGENTEX_API_BASE_URL = os.environ.get("AGENTEX_API_BASE_URL", "http://localhost:5003") -AGENT_NAME = os.environ.get("AGENT_NAME", "example-tutorial") +AGENT_NAME = os.environ.get("AGENT_NAME", "at060-open-ai-agents-sdk-hello-world") @pytest_asyncio.fixture diff --git a/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/README.md b/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/README.md index 9dee3544..ea2c827a 100644 --- a/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/README.md +++ b/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/README.md @@ -26,7 +26,7 @@ Two patterns for making agent tools durable with Temporal: ## Quick Start ```bash -cd examples/tutorials/10_agentic/10_temporal/070_open_ai_agents_sdk_tools +cd examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools uv run agentex agents run --manifest manifest.yaml ``` diff --git a/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/dev.ipynb b/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/dev.ipynb index 04aa5cb9..bcfc7182 100644 --- a/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/dev.ipynb +++ b/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/dev.ipynb @@ -18,9 +18,7 @@ "id": "d1c309d6", "metadata": {}, "outputs": [], - "source": [ - "AGENT_NAME = \"example-tutorial\"" - ] + "source": "AGENT_NAME = \"at070-open-ai-agents-sdk-tools\"" }, { "cell_type": "code", diff --git a/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/manifest.yaml b/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/manifest.yaml index fc57b09c..286a5c28 100644 --- a/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/manifest.yaml +++ b/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/manifest.yaml @@ -67,7 +67,7 @@ agent: # Unique name for your agent # Used for task routing and monitoring - name: example-tutorial + name: at070-open-ai-agents-sdk-tools # Description of what your agent does # Helps with documentation and discovery @@ -80,12 +80,12 @@ agent: workflows: # Name of the workflow class # Must match the @workflow.defn name in your workflow.py - - name: example-tutorial + - name: at070-open-ai-agents-sdk-tools # Queue name for task distribution # Used by Temporal to route tasks to your agent # Convention: _task_queue - queue_name: example_tutorial_queue + queue_name: at070_open_ai_agents_sdk_tools_queue # Optional: Credentials mapping # Maps Kubernetes secrets to environment variables @@ -98,12 +98,13 @@ agent: # secret_name: openai-api-key # secret_key: api-key - # Optional: Set Environment variables for running your agent locally as well + # Optional: Set Environment variables for running your agent locally as well # as for deployment later on - env: - OPENAI_API_KEY: "" + env: {} + # OPENAI_API_KEY: "" # OPENAI_BASE_URL: "" - OPENAI_ORG_ID: "" + # OPENAI_ORG_ID: "" + # Deployment Configuration # ----------------------- @@ -121,7 +122,7 @@ deployment: # These can be overridden using --override-file with custom configuration files global: agent: - name: "example-tutorial" + name: "at070-open-ai-agents-sdk-tools" description: "An AgentEx agent" # Default replica count diff --git a/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/project/acp.py b/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/project/acp.py index eb7f99a5..3028093b 100644 --- a/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/project/acp.py +++ b/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/project/acp.py @@ -44,7 +44,7 @@ # Create the ACP server acp = FastACP.create( - acp_type="agentic", + acp_type="async", config=TemporalACPConfig( # When deployed to the cluster, the Temporal address will automatically be set to the cluster address # For local development, we set the address manually to talk to the local Temporal service set up via docker compose diff --git a/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/project/run_worker.py b/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/project/run_worker.py index 5c34a2f1..a5d8db0d 100644 --- a/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/project/run_worker.py +++ b/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/project/run_worker.py @@ -2,7 +2,7 @@ from temporalio.contrib.openai_agents import OpenAIAgentsPlugin -from project.workflow import ExampleTutorialWorkflow +from project.workflow import At070OpenAiAgentsSdkToolsWorkflow from project.activities import get_weather, deposit_money, withdraw_money from agentex.lib.utils.debug import setup_debug_if_enabled from agentex.lib.utils.logging import make_logger @@ -64,7 +64,7 @@ async def main(): await worker.run( activities=all_activities, - workflow=ExampleTutorialWorkflow, + workflow=At070OpenAiAgentsSdkToolsWorkflow, ) if __name__ == "__main__": diff --git a/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/project/workflow.py b/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/project/workflow.py index 99647497..ef4da1df 100644 --- a/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/project/workflow.py +++ b/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/project/workflow.py @@ -111,7 +111,7 @@ class StateModel(BaseModel): @workflow.defn(name=environment_variables.WORKFLOW_NAME) -class ExampleTutorialWorkflow(BaseWorkflow): +class At070OpenAiAgentsSdkToolsWorkflow(BaseWorkflow): """ Minimal async workflow template for AgentEx Temporal agents. """ diff --git a/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/pyproject.toml b/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/pyproject.toml index 57c46347..22f4e008 100644 --- a/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/pyproject.toml +++ b/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/pyproject.toml @@ -3,14 +3,14 @@ requires = ["hatchling"] build-backend = "hatchling.build" [project] -name = "example_tutorial" +name = "at070_open_ai_agents_sdk_tools" version = "0.1.0" description = "An AgentEx agent" requires-python = ">=3.12" dependencies = [ - "agentex-sdk==0.6.0", - "openai-agents-sdk==0.4.2", - "temporalio==1.18.2", + "agentex-sdk>=0.6.0", + "openai-agents>=0.4.2", + "temporalio>=1.18.2", "scale-gp", ] @@ -32,4 +32,4 @@ target-version = ['py312'] [tool.isort] profile = "black" -line_length = 88 \ No newline at end of file +line_length = 88 diff --git a/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/tests/test_agent.py b/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/tests/test_agent.py index 85691b6d..496f3b96 100644 --- a/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/tests/test_agent.py +++ b/examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/tests/test_agent.py @@ -20,7 +20,7 @@ import pytest import pytest_asyncio -from test_utils.agentic import ( +from test_utils.async_utils import ( poll_messages, send_event_and_poll_yielding, ) @@ -31,7 +31,7 @@ # Configuration from environment variables AGENTEX_API_BASE_URL = os.environ.get("AGENTEX_API_BASE_URL", "http://localhost:5003") -AGENT_NAME = os.environ.get("AGENT_NAME", "example-tutorial") +AGENT_NAME = os.environ.get("AGENT_NAME", "at070-open-ai-agents-sdk-tools") @pytest_asyncio.fixture diff --git a/examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/dev.ipynb b/examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/dev.ipynb index 2b5cec6b..3e93e183 100644 --- a/examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/dev.ipynb +++ b/examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/dev.ipynb @@ -18,9 +18,7 @@ "id": "d1c309d6", "metadata": {}, "outputs": [], - "source": [ - "AGENT_NAME = \"example-tutorial\"" - ] + "source": "AGENT_NAME = \"at080-open-ai-agents-sdk-human-in-the-loop\"" }, { "cell_type": "code", @@ -123,4 +121,4 @@ }, "nbformat": 4, "nbformat_minor": 5 -} +} \ No newline at end of file diff --git a/examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/manifest.yaml b/examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/manifest.yaml index 55d108ab..9562ec94 100644 --- a/examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/manifest.yaml +++ b/examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/manifest.yaml @@ -69,7 +69,7 @@ agent: # Unique name for your agent # Used for task routing and monitoring - name: example-tutorial + name: at080-open-ai-agents-sdk-human-in-the-loop # Description of what your agent does # Helps with documentation and discovery @@ -82,12 +82,12 @@ agent: workflows: # Name of the workflow class # Must match the @workflow.defn name in your workflow.py - - name: example-tutorial + - name: at080-open-ai-agents-sdk-human-in-the-loop # Queue name for task distribution # Used by Temporal to route tasks to your agent # Convention: _task_queue - queue_name: example_tutorial_queue + queue_name: at080_open_ai_agents_sdk_human_in_the_loop_queue # Optional: Credentials mapping # Maps Kubernetes secrets to environment variables @@ -100,12 +100,12 @@ agent: # secret_name: openai-api-key # secret_key: api-key - # Optional: Set Environment variables for running your agent locally as well + # Optional: Set Environment variables for running your agent locally as well # as for deployment later on - env: - OPENAI_API_KEY: "" + env: {} + # OPENAI_API_KEY: "" # Set this in your shell environment instead # OPENAI_BASE_URL: "" - OPENAI_ORG_ID: "" + # OPENAI_ORG_ID: "" # Deployment Configuration @@ -124,7 +124,7 @@ deployment: # These can be overridden using --override-file with custom configuration files global: agent: - name: "example-tutorial" + name: "at080-open-ai-agents-sdk-human-in-the-loop" description: "An AgentEx agent" # Default replica count @@ -137,4 +137,4 @@ deployment: memory: "1Gi" limits: cpu: "1000m" - memory: "2Gi" \ No newline at end of file + memory: "2Gi" diff --git a/examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/project/run_worker.py b/examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/project/run_worker.py index 53b245f3..187017e4 100644 --- a/examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/project/run_worker.py +++ b/examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/project/run_worker.py @@ -2,7 +2,7 @@ from temporalio.contrib.openai_agents import OpenAIAgentsPlugin -from project.workflow import ExampleTutorialWorkflow +from project.workflow import At080OpenAiAgentsSdkHumanInTheLoopWorkflow from project.activities import confirm_order, deposit_money, withdraw_money from project.child_workflow import ChildWorkflow from agentex.lib.utils.debug import setup_debug_if_enabled @@ -66,7 +66,7 @@ async def main(): await worker.run( activities=all_activities, - workflows=[ExampleTutorialWorkflow, ChildWorkflow] + workflows=[At080OpenAiAgentsSdkHumanInTheLoopWorkflow, ChildWorkflow] ) if __name__ == "__main__": diff --git a/examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/project/workflow.py b/examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/project/workflow.py index 37e5dbc5..09d15862 100644 --- a/examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/project/workflow.py +++ b/examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/project/workflow.py @@ -86,7 +86,7 @@ class StateModel(BaseModel): @workflow.defn(name=environment_variables.WORKFLOW_NAME) -class ExampleTutorialWorkflow(BaseWorkflow): +class At080OpenAiAgentsSdkHumanInTheLoopWorkflow(BaseWorkflow): """ Human-in-the-Loop Temporal Workflow diff --git a/examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/pyproject.toml b/examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/pyproject.toml index 57c46347..b38ee6e6 100644 --- a/examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/pyproject.toml +++ b/examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/pyproject.toml @@ -3,14 +3,14 @@ requires = ["hatchling"] build-backend = "hatchling.build" [project] -name = "example_tutorial" +name = "at080_open_ai_agents_sdk_human_in_the_loop" version = "0.1.0" description = "An AgentEx agent" requires-python = ">=3.12" dependencies = [ - "agentex-sdk==0.6.0", - "openai-agents-sdk==0.4.2", - "temporalio==1.18.2", + "agentex-sdk>=0.6.0", + "openai-agents>=0.4.2", + "temporalio>=1.18.2", "scale-gp", ] @@ -32,4 +32,4 @@ target-version = ['py312'] [tool.isort] profile = "black" -line_length = 88 \ No newline at end of file +line_length = 88 diff --git a/examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/tests/test_agent.py b/examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/tests/test_agent.py index c229aa18..5b0c2f74 100644 --- a/examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/tests/test_agent.py +++ b/examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/tests/test_agent.py @@ -28,7 +28,7 @@ # Temporal imports for signaling child workflows from temporalio.client import Client as TemporalClient -from test_utils.agentic import ( +from test_utils.async_utils import ( poll_messages, send_event_and_poll_yielding, ) @@ -39,7 +39,7 @@ # Configuration from environment variables AGENTEX_API_BASE_URL = os.environ.get("AGENTEX_API_BASE_URL", "http://localhost:5003") -AGENT_NAME = os.environ.get("AGENT_NAME", "example-tutorial") +AGENT_NAME = os.environ.get("AGENT_NAME", "at080-open-ai-agents-sdk-human-in-the-loop") TEMPORAL_ADDRESS = os.environ.get("TEMPORAL_ADDRESS", "localhost:7233") diff --git a/examples/tutorials/run_all_async_tests.sh b/examples/tutorials/run_all_async_tests.sh index b175edc3..ac9c2fac 100755 --- a/examples/tutorials/run_all_async_tests.sh +++ b/examples/tutorials/run_all_async_tests.sh @@ -45,24 +45,23 @@ done # Find all async tutorial directories ALL_TUTORIALS=( # sync tutorials - "00_sync/000_hello_acp" - "00_sync/010_multiturn" - "00_sync/020_streaming" + #"00_sync/000_hello_acp" + #"00_sync/010_multiturn" + #"00_sync/020_streaming" # base tutorials - "10_async/00_base/000_hello_acp" - "10_async/00_base/010_multiturn" - "10_async/00_base/020_streaming" - "10_async/00_base/030_tracing" - "10_async/00_base/040_other_sdks" - "10_async/00_base/080_batch_events" -# "10_async/00_base/090_multi_agent_non_temporal" This will require its own version of this + # "10_async/00_base/000_hello_acp" + # "10_async/00_base/010_multiturn" + # "10_async/00_base/020_streaming" + # "10_async/00_base/030_tracing" + # "10_async/00_base/040_other_sdks" + # "10_async/00_base/080_batch_events" # temporal tutorials - "10_async/10_temporal/000_hello_acp" - "10_async/10_temporal/010_agent_chat" - "10_async/10_temporal/020_state_machine" - "10_agentic/10_temporal/060_open_ai_agents_sdk_hello_world" - "10_agentic/10_temporal/070_open_ai_agents_sdk_tools" - "10_agentic/10_temporal/080_open_ai_agents_sdk_human_in_the_loop" + # "10_async/10_temporal/000_hello_acp" + # "10_async/10_temporal/010_agent_chat" + # "10_async/10_temporal/020_state_machine" + "10_async/10_temporal/060_open_ai_agents_sdk_hello_world" + "10_async/10_temporal/070_open_ai_agents_sdk_tools" + "10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop" ) PASSED=0 @@ -386,4 +385,4 @@ main() { } # Run main function -main \ No newline at end of file +main diff --git a/examples/tutorials/test_utils/async_utils.py b/examples/tutorials/test_utils/async_utils.py index 2bfa2d7d..9c124d24 100644 --- a/examples/tutorials/test_utils/async_utils.py +++ b/examples/tutorials/test_utils/async_utils.py @@ -46,8 +46,9 @@ async def send_event_and_poll_yielding( event_content = TextContentParam(type="text", author="user", content=user_message) # Capture timestamp before sending to account for clock skew - # Subtract 1 second buffer to ensure we don't filter out messages we just created - messages_created_after = time.time() - 1.0 + # Subtract 2 second buffer to ensure we don't filter out messages we just created + # (accounts for clock skew between client and server) + messages_created_after = time.time() - 2.0 await client.agents.send_event( agent_id=agent_id, params=ParamsSendEventRequest(task_id=task_id, content=event_content) @@ -78,9 +79,16 @@ async def poll_messages( # Poll continuously until timeout while (datetime.now() - start_time).seconds < timeout: messages = await client.messages.list(task_id=task_id) - # print("DEBGUG: Messages found: ", messages) + + # Sort messages by created_at to ensure chronological order + # Use datetime.min for messages without created_at timestamp + sorted_messages = sorted( + messages, + key=lambda m: m.created_at if m.created_at else datetime.min.replace(tzinfo=timezone.utc) + ) + new_messages_found = 0 - for message in messages: + for message in sorted_messages: # Skip if we've already yielded this message if message.id in seen_message_ids: continue diff --git a/src/agentex/lib/adk/providers/_modules/openai.py b/src/agentex/lib/adk/providers/_modules/openai.py index 5d1e7ecc..b9824227 100644 --- a/src/agentex/lib/adk/providers/_modules/openai.py +++ b/src/agentex/lib/adk/providers/_modules/openai.py @@ -392,7 +392,7 @@ async def run_agent_streamed( @deprecated( "Use the OpenAI Agents SDK integration with Temporal instead. " - "See examples in tutorials/10_agentic/10_temporal/ for migration guidance." + "See examples in tutorials/10_async/10_temporal/ for migration guidance." ) async def run_agent_streamed_auto_send( self, @@ -426,7 +426,7 @@ async def run_agent_streamed_auto_send( .. deprecated:: Use the OpenAI Agents SDK integration with Temporal instead. - See examples in tutorials/10_agentic/10_temporal/ for migration guidance. + See examples in tutorials/10_async/10_temporal/ for migration guidance. Args: task_id: The ID of the task to run the agent for. diff --git a/uv.lock b/uv.lock index b3c312a2..b2e419c4 100644 --- a/uv.lock +++ b/uv.lock @@ -8,7 +8,7 @@ resolution-markers = [ [[package]] name = "agentex-sdk" -version = "0.6.0" +version = "0.6.2" source = { editable = "." } dependencies = [ { name = "aiohttp" },