-
-
Notifications
You must be signed in to change notification settings - Fork 458
Open
Description
Hi and thanks for this library! I am trying to understand how it works, what should I call etc..
I will be very grateful if someone can guide me through the following example.
What I want to do is to have an orchestrator agent which will decide which agent to call. Each agent should have access to specific tools (functions).
-
modification agent: modify the csv data
- tools : modify_weather_data
-
forecast agent: makes the forecast
- tools: run_forecast_model
-
analysis agent: runs the analysis and provides results (plots, metrics)
- tools: create_comparison_plot , calculate_impact_metrics, format_impact_analysis
(the tools are just python functions. I am not sure if we have to create custom Tools??)
So, the setup I use:
# ─── 1) Modification Data Agent
class ModificationInputSchema(BaseIOSchema):
'''Modify data'''
data_path: str = Field(..., description="Path to original weather data CSV")
variable: str = Field(..., description="Weather variable to perturb")
scenario_type: str = Field(..., description="Scenario template text")
value: float = Field(..., description="Perturbation magnitude")
days: int | None = Field(None, description="Duration in days, if applicable")
class ModificationOutputSchema(BaseIOSchema):
'''Modified data'''
modified_data_path: str = Field(..., description="Path to the modified data CSV")
scenario_desc: str = Field(..., description="Description of modification applied")
mod_system_prompt = SystemPromptGenerator(
background=["You are a data analysis agent."],
steps=[
"Validate parameters",
"Decide call to modify_weather_data tool",
"Emit JSON matching ModificationOutputSchema"
],
output_instructions=["Return JSON exactly matching ModificationOutputSchema"]
)
modification_agent = BaseAgent(
config=BaseAgentConfig(
client=client,
model=model,
system_prompt_generator=mod_system_prompt,
memory=AgentMemory(),
input_schema=ModificationInputSchema,
output_schema=ModificationOutputSchema
)
)
# ─── 2) Forecast Agent
class ForecastInputSchema(BaseIOSchema):
'''Forecast'''
data_path: str = Field(..., description="CSV for forecasting")
variable: str = Field(..., description="Target variable to forecast")
periods: int = Field(..., description="Days ahead to forecast")
is_original: bool = Field(..., description="True for original data, False for modified")
class ForecastOutputSchema(BaseIOSchema):
'''Forecast'''
forecast_path: str = Field(..., description="Path to the forecast CSV")
forecast_system_prompt = SystemPromptGenerator(
background=["You are a forecasting agent."],
steps=[
"Validate inputs",
"Decide call to run_forecast_model tool",
"Emit JSON matching ForecastOutputSchema"
],
output_instructions=["Return JSON exactly matching ForecastOutputSchema"]
)
forecast_agent = BaseAgent(
config=BaseAgentConfig(
client=client,
model=model,
system_prompt_generator=forecast_system_prompt,
memory=AgentMemory(),
input_schema=ForecastInputSchema,
output_schema=ForecastOutputSchema
)
)
# ─── 3) Analysis Agent
class AnalysisInputSchema(BaseIOSchema):
'''Analysis'''
original_forecast_path: str = Field(..., description="Original forecast CSV path")
modified_forecast_path: str = Field(..., description="Modified forecast CSV path")
variable: str = Field(..., description="Variable being compared")
class AnalysisOutputSchema(BaseIOSchema):
'''Analysis'''
comparison_plot_path: str = Field(..., description="Path to saved comparison plot")
impact_metrics: dict = Field(..., description="Raw metrics dictionary")
impact_analysis: str = Field(..., description="Formatted markdown analysis")
analysis_system_prompt = SystemPromptGenerator(
background=["You are an analysis agent."],
steps=[
"Plan calls to comparison and metrics tools",
"Emit JSON matching AnalysisOutputSchema"
],
output_instructions=["Return JSON exactly matching AnalysisOutputSchema"]
)
analysis_agent = BaseAgent(
config=BaseAgentConfig(
client=client,
model=model,
system_prompt_generator=analysis_system_prompt,
memory=AgentMemory(),
input_schema=AnalysisInputSchema,
output_schema=AnalysisOutputSchema
)
)
Now, regarding the orchestrator, I am not sure how to setup! ( i have checked the example but I can't figure)
So, I can't figure how to
- setup the orchstrator in order to decide which agent it should call
- make each agent to have access to the specific tool/tools
- can I just use the python funtions as tools or do i have ot create a tool class?
Thank you!
Metadata
Metadata
Assignees
Labels
No labels