From 81311ed2758a5374520d2eeb2cf5af9f8ae7711f Mon Sep 17 00:00:00 2001 From: IAmNo1Special Date: Wed, 9 Apr 2025 23:25:41 -0400 Subject: [PATCH 1/5] Update tutorial.md Added asyncio.run as an alternative to running conversations using await. *Fixes the 'using await outside async function' error. --- docs/get-started/tutorial.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/get-started/tutorial.md b/docs/get-started/tutorial.md index 69411d69f9..6477fc19ce 100644 --- a/docs/get-started/tutorial.md +++ b/docs/get-started/tutorial.md @@ -252,6 +252,9 @@ async def run_conversation(): # Execute the conversation using await in an async context (like Colab/Jupyter) await run_conversation() + +# Alternatively, execute the conversation using asyncio +#asyncio.run(run_conversation()) ``` **Expected Output:** @@ -464,6 +467,9 @@ Now, execute the conversation. Ensure your API keys are correctly set in Step 0\ # Note: Requires API keys for Gemini, GPT, and Claude to be set correctly! await run_multi_model_conversation() +# Alternatively, execute the conversation using asyncio +#asyncio.run(run__multi_model_conversation()) + ``` **Expected Output:** @@ -714,6 +720,9 @@ if runner_root: # Execute the conversation # Note: This may require API keys for the models used by root and sub-agents! await run_team_conversation() + + # Alternatively, execute the conversation using asyncio + #asyncio.run(run_team_conversation()) else: print("\n⚠️ Skipping agent team conversation as the root agent runner ('runner_root') is not available.") @@ -1017,6 +1026,9 @@ if runner_root_stateful: # Execute the conversation await run_stateful_conversation() + # Alternatively, execute the conversation using asyncio + #asyncio.run(run_stateful_conversation()) + # Inspect final session state after the conversation final_session = session_service_stateful.get_session(APP_NAME, USER_ID_STATEFUL, SESSION_ID_STATEFUL) if final_session: @@ -1275,6 +1287,9 @@ if runner_root_model_guardrail: # Execute the conversation await run_guardrail_test_conversation() + # Alternatively, execute the conversation using asyncio + #asyncio.run(run_guardrail_conversation()) + # Optional: Check state for the trigger flag set by the callback final_session = session_service_stateful.get_session(APP_NAME, USER_ID_STATEFUL, SESSION_ID_STATEFUL) if final_session: @@ -1501,6 +1516,9 @@ if runner_root_tool_guardrail: # Execute the conversation await run_tool_guardrail_test() + # Alternatively, execute the conversation using asyncio + #asyncio.run(run_guardrail_test()) + # Optional: Check state for the tool block trigger flag final_session = session_service_stateful.get_session(APP_NAME, USER_ID_STATEFUL, SESSION_ID_STATEFUL) if final_session: From dfc16d1d2c521423c248fdd669aab36f9f699a09 Mon Sep 17 00:00:00 2001 From: IAmNo1Special Date: Thu, 10 Apr 2025 00:12:13 -0400 Subject: [PATCH 2/5] Update tutorial.md Fixed typo - asyncio.run(run_guardrail_conversation()) to asyncio.run(run_guardrail_test_conversation()) --- docs/get-started/tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/get-started/tutorial.md b/docs/get-started/tutorial.md index 6477fc19ce..2fdb9043e5 100644 --- a/docs/get-started/tutorial.md +++ b/docs/get-started/tutorial.md @@ -1288,7 +1288,7 @@ if runner_root_model_guardrail: await run_guardrail_test_conversation() # Alternatively, execute the conversation using asyncio - #asyncio.run(run_guardrail_conversation()) + #asyncio.run(run_guardrail_test_conversation()) # Optional: Check state for the trigger flag set by the callback final_session = session_service_stateful.get_session(APP_NAME, USER_ID_STATEFUL, SESSION_ID_STATEFUL) From 386fd1e90468bc9c58ccc8bcda662e6e43c1eba5 Mon Sep 17 00:00:00 2001 From: IAmNo1Special Date: Thu, 10 Apr 2025 12:08:50 -0400 Subject: [PATCH 3/5] Update tutorial.md adding text to call out the dev environment. --- docs/get-started/tutorial.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/get-started/tutorial.md b/docs/get-started/tutorial.md index 2fdb9043e5..a947e78f4c 100644 --- a/docs/get-started/tutorial.md +++ b/docs/get-started/tutorial.md @@ -253,8 +253,8 @@ async def run_conversation(): # Execute the conversation using await in an async context (like Colab/Jupyter) await run_conversation() -# Alternatively, execute the conversation using asyncio -#asyncio.run(run_conversation()) +# Alternatively, if you are not using Jupyter/ Colab, execute the conversation using asyncio +# asyncio.run(run_conversation()) ``` **Expected Output:** @@ -467,8 +467,8 @@ Now, execute the conversation. Ensure your API keys are correctly set in Step 0\ # Note: Requires API keys for Gemini, GPT, and Claude to be set correctly! await run_multi_model_conversation() -# Alternatively, execute the conversation using asyncio -#asyncio.run(run__multi_model_conversation()) +# Alternatively, if you are not using Jupyter/ Colab, execute the conversation using asyncio +# asyncio.run(run__multi_model_conversation()) ``` @@ -721,8 +721,8 @@ if runner_root: # Note: This may require API keys for the models used by root and sub-agents! await run_team_conversation() - # Alternatively, execute the conversation using asyncio - #asyncio.run(run_team_conversation()) + # Alternatively, if you are not using Jupyter/ Colab, execute the conversation using asyncio + # asyncio.run(run_team_conversation()) else: print("\n⚠️ Skipping agent team conversation as the root agent runner ('runner_root') is not available.") @@ -1026,8 +1026,8 @@ if runner_root_stateful: # Execute the conversation await run_stateful_conversation() - # Alternatively, execute the conversation using asyncio - #asyncio.run(run_stateful_conversation()) + # Alternatively, if you are not using Jupyter/ Colab, execute the conversation using asyncio + # asyncio.run(run_stateful_conversation()) # Inspect final session state after the conversation final_session = session_service_stateful.get_session(APP_NAME, USER_ID_STATEFUL, SESSION_ID_STATEFUL) @@ -1287,8 +1287,8 @@ if runner_root_model_guardrail: # Execute the conversation await run_guardrail_test_conversation() - # Alternatively, execute the conversation using asyncio - #asyncio.run(run_guardrail_test_conversation()) + # Alternatively, if you are not using Jupyter/ Colab, execute the conversation using asyncio + # asyncio.run(run_guardrail_test_conversation()) # Optional: Check state for the trigger flag set by the callback final_session = session_service_stateful.get_session(APP_NAME, USER_ID_STATEFUL, SESSION_ID_STATEFUL) @@ -1516,8 +1516,8 @@ if runner_root_tool_guardrail: # Execute the conversation await run_tool_guardrail_test() - # Alternatively, execute the conversation using asyncio - #asyncio.run(run_guardrail_test()) + # Alternatively, if you are not using Jupyter/ Colab, execute the conversation using asyncio + # asyncio.run(run_guardrail_test()) # Optional: Check state for the tool block trigger flag final_session = session_service_stateful.get_session(APP_NAME, USER_ID_STATEFUL, SESSION_ID_STATEFUL) From 7897156e086846889a3e486706010b33b6f95781 Mon Sep 17 00:00:00 2001 From: Malcom-Thigpen Date: Fri, 11 Apr 2025 15:13:40 -0400 Subject: [PATCH 4/5] Improve code formatting: Add proper line breaks for asyncio.run() examples --- docs/get-started/tutorial.md | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/docs/get-started/tutorial.md b/docs/get-started/tutorial.md index 5491d696c6..9d541ecfa1 100644 --- a/docs/get-started/tutorial.md +++ b/docs/get-started/tutorial.md @@ -503,10 +503,14 @@ try: session_id=SESSION_ID_GPT) # Alternatively, if you are not using Jupyter/ Colab, execute the conversation using asyncio - # asyncio.run(call_agent_async(query = "What's the weather in Tokyo?", - runner=runner_gpt, - user_id=USER_ID_GPT, - session_id=SESSION_ID_GPT)) + # asyncio.run( + # call_agent_async( + # query = "What's the weather in Tokyo?", + # runner=runner_gpt, + # user_id=USER_ID_GPT, + # session_id=SESSION_ID_GPT + # ) + # ) except Exception as e: print(f"❌ Could not create or run GPT agent '{MODEL_GPT_4O}'. Check API Key and model name. Error: {e}") @@ -572,10 +576,14 @@ try: session_id=SESSION_ID_CLAUDE) # Alternatively, if you are not using Jupyter/ Colab, execute the conversation using asyncio - # asyncio.run(call_agent_async(query = "Weather in London please.", - runner=runner_claude, - user_id=USER_ID_CLAUDE, - session_id=SESSION_ID_CLAUDE)) + # asyncio.run( + # call_agent_async( + # query = "Weather in London please.", + # runner=runner_claude, + # user_id=USER_ID_CLAUDE, + # session_id=SESSION_ID_CLAUDE + # ) + # ) except Exception as e: print(f"❌ Could not create or run Claude agent '{MODEL_CLAUDE_SONNET}'. Check API Key and model name. Error: {e}") From c21889bd32f372cdd78036ce37d84bcb74273ef1 Mon Sep 17 00:00:00 2001 From: Malcom-Thigpen Date: Fri, 11 Apr 2025 15:59:30 -0400 Subject: [PATCH 5/5] - Replace echo command with Python file creation --- docs/get-started/quickstart.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/get-started/quickstart.md b/docs/get-started/quickstart.md index 4c7e25a137..fa759e844f 100644 --- a/docs/get-started/quickstart.md +++ b/docs/get-started/quickstart.md @@ -53,7 +53,7 @@ mkdir multi_tool_agent/ Now create an `__init__.py` file in the folder: ```shell -echo "from . import agent" > multi_tool_agent/__init__.py +python -c "with open('multi_tool_agent/init.py', 'w') as f: f.write('from . import agent\n')" ``` Your `__init__.py` should now look like this: