Skip to content

Commit

Permalink
Make RunContext internal (#386)
Browse files Browse the repository at this point in the history
* Make RunContext internal

* Mypy
  • Loading branch information
ekzhu authored Aug 21, 2024
1 parent 09ceef4 commit ed08905
Show file tree
Hide file tree
Showing 40 changed files with 2,360 additions and 2,329 deletions.
598 changes: 299 additions & 299 deletions python/docs/src/cookbook/langgraph-agent.ipynb

Large diffs are not rendered by default.

1,062 changes: 531 additions & 531 deletions python/docs/src/cookbook/llamaindex-agent.ipynb

Large diffs are not rendered by default.

1,680 changes: 840 additions & 840 deletions python/docs/src/cookbook/openai-assistant-agent.ipynb

Large diffs are not rendered by default.

511 changes: 261 additions & 250 deletions python/docs/src/getting-started/agent-and-agent-runtime.ipynb

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions python/docs/src/getting-started/message-and-communication.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@
}
],
"source": [
"run_context = runtime.start()\n",
"runtime.start()\n",
"await runtime.send_message(TextMessage(content=\"Hello, World!\", source=\"User\"), agent)\n",
"await runtime.send_message(ImageMessage(url=\"https://example.com/image.jpg\", source=\"User\"), agent)\n",
"await run_context.stop_when_idle()"
"await runtime.stop_when_idle()"
]
},
{
Expand Down Expand Up @@ -241,10 +241,10 @@
"runtime = SingleThreadedAgentRuntime()\n",
"await runtime.register(\"inner_agent\", lambda: InnerAgent(\"InnerAgent\"))\n",
"await runtime.register(\"outer_agent\", lambda: OuterAgent(\"OuterAgent\", \"InnerAgent\"))\n",
"run_context = runtime.start()\n",
"runtime.start()\n",
"outer = AgentId(\"outer_agent\", \"default\")\n",
"await runtime.send_message(Message(content=\"Hello, World!\"), outer)\n",
"await run_context.stop_when_idle()"
"await runtime.stop_when_idle()"
]
},
{
Expand Down Expand Up @@ -344,9 +344,9 @@
"await runtime.register(\"receiving_agent\", lambda: ReceivingAgent(\"Receiving Agent\"))\n",
"await runtime.add_subscription(TypeSubscription(\"default\", \"broadcasting_agent\"))\n",
"await runtime.add_subscription(TypeSubscription(\"default\", \"receiving_agent\"))\n",
"run_context = runtime.start()\n",
"runtime.start()\n",
"await runtime.send_message(Message(\"Hello, World!\"), AgentId(\"broadcasting_agent\", \"default\"))\n",
"await run_context.stop_when_idle()"
"await runtime.stop()"
]
},
{
Expand Down Expand Up @@ -380,9 +380,9 @@
"await runtime.register(\"receiving_agent\", lambda: ReceivingAgent(\"Receiving Agent\"))\n",
"await runtime.add_subscription(TypeSubscription(\"default\", \"broadcasting_agent\"))\n",
"await runtime.add_subscription(TypeSubscription(\"default\", \"receiving_agent\"))\n",
"run_context = runtime.start()\n",
"runtime.start()\n",
"await runtime.publish_message(Message(\"Hello, World! From the runtime!\"), topic_id=TopicId(\"default\", \"default\"))\n",
"await run_context.stop_when_idle()"
"await runtime.stop_when_idle()"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions python/docs/src/getting-started/model-clients.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,13 @@
" ),\n",
")\n",
"# Start the runtime processing messages.\n",
"run_context = runtime.start()\n",
"runtime.start()\n",
"# Send a message to the agent and get the response.\n",
"message = Message(\"Hello, what are some fun things to do in Seattle?\")\n",
"response = await runtime.send_message(message, AgentId(\"simple-agent\", \"default\"))\n",
"print(response.content)\n",
"# Stop the runtime processing messages.\n",
"await run_context.stop()"
"await runtime.stop()"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,14 +509,14 @@
" lambda: CoderAgent(model_client=OpenAIChatCompletionClient(model=\"gpt-4o-mini\")),\n",
")\n",
"await runtime.add_subscription(TypeSubscription(\"default\", \"ReviewerAgent\"))\n",
"run_context = runtime.start()\n",
"runtime.start()\n",
"await runtime.publish_message(\n",
" message=CodeWritingTask(task=\"Write a function to find the sum of all even numbers in a list.\"),\n",
" topic_id=TopicId(\"default\", \"default\"),\n",
")\n",
"\n",
"# Keep processing messages until idle.\n",
"await run_context.stop_when_idle()"
"await runtime.stop_when_idle()"
]
},
{
Expand Down
Loading

0 comments on commit ed08905

Please sign in to comment.