Helper function to create a Nebrowski task for both sync and async tests. Returns a configured Task ready to run.
()
| 89 | |
| 90 | |
| 91 | def _create_nebrowski_task(): |
| 92 | """ |
| 93 | Helper function to create a Nebrowski task for both sync and async tests. |
| 94 | Returns a configured Task ready to run. |
| 95 | """ |
| 96 | # Configure the main agent with a real LLM |
| 97 | main_config = ChatAgentConfig( |
| 98 | llm=OpenAIGPTConfig(), # Uses default model |
| 99 | handle_llm_no_tool="you forgot to use one of your TOOLs!", |
| 100 | system_message=f""" |
| 101 | You are a Nebrowski operation specialist. The Nebrowski operation is an exotic |
| 102 | mathematical function that takes two numbers and produces a result. |
| 103 | BUT you do NOT know how to compute it yourself! |
| 104 | |
| 105 | When the user asks you to compute nested Nebrowski operations like |
| 106 | Nebrowski(a, Nebrowski(b, c)), you MUST: |
| 107 | |
| 108 | 1. Break it down into individual Nebrowski operations |
| 109 | 2. Use the TOOL `{TaskTool.name()}` to delegate each Nebrowski |
| 110 | operation to a sub-agent |
| 111 | 3. The sub-agent knows how to use the `{NebrowskiTool.name()}` tool |
| 112 | |
| 113 | For example, to compute Nebrowski(10, Nebrowski(3, 2)): |
| 114 | - First compute inner: Nebrowski(3, 2) = result1 (using TaskTool) |
| 115 | - Then compute outer: Nebrowski(10, result1) (using TaskTool) |
| 116 | - Return the final result |
| 117 | |
| 118 | IMPORTANT: You must use TaskTool for EACH Nebrowski operation. |
| 119 | Configure the TaskTool with: |
| 120 | - system_message: Instructions for the sub-agent to compute Nebrowski |
| 121 | - prompt: The specific Nebrowski task (e.g., "Compute Nebrowski(3, 2)") |
| 122 | - tools: ["nebrowski_tool"] |
| 123 | - model: "gpt-4o-mini" |
| 124 | |
| 125 | Remember: You cannot compute Nebrowski operations yourself - you must |
| 126 | delegate to sub-agents! |
| 127 | |
| 128 | You MUST use the TOOL `{DoneTool.name()}` to return the final result! |
| 129 | """, |
| 130 | name="NebrowskiAgent", |
| 131 | ) |
| 132 | main_agent = ChatAgent(main_config) |
| 133 | |
| 134 | # Enable TaskTool and NebrowskiTool |
| 135 | main_agent.enable_message( |
| 136 | [DoneTool, TaskTool, NebrowskiTool], use=True, handle=True |
| 137 | ) |
| 138 | |
| 139 | # Create task with appropriate configuration |
| 140 | task = Task( |
| 141 | main_agent, |
| 142 | name="NebrowskiTask", |
| 143 | interactive=False, |
| 144 | ) |
| 145 | |
| 146 | return task |
| 147 | |
| 148 |
no test coverage detected
searching dependent graphs…