-
Notifications
You must be signed in to change notification settings - Fork 12
feat: agents #321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: agents #321
Conversation
| class AgentRuns: | ||
| """Agent runs interface that delegates to maestro""" | ||
|
|
||
| def __init__(self, agents_client, maestro_runs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing type annotations
| """Create an agent run using maestro client with agent configuration""" | ||
| agent = self._agents_client.get(agent_id) | ||
|
|
||
| # Use Pydantic converter to handle parameter conversion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment necessary?
| name: str, | ||
| description: Union[str, NotGiven] = NOT_GIVEN, | ||
| models: Union[List[str], NotGiven] = NOT_GIVEN, | ||
| tools: Union[List[Dict[str, Any]], NotGiven] = NOT_GIVEN, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please use this syntax str | NotGiven = NOT_GIVEN?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might need to add from __future__ import annotations at the top of the file to make it work for older versions
|
@benshuk PTAL as well |
Summary
This PR introduces comprehensive Agent functionality to the AI21 Python SDK, providing full CRUD operations and execution capabilities for AI agents through direct Maestro integration.
Key Features Added:
Agent Management:
Agent Execution via Maestro Integration:
Clean Architecture:
Usage Examples:
Agent CRUD Operations:
Agent Execution:
Async Usage:
Technical Implementation:
Core Components:
agents.py,async_agents.py)AgentToMaestroRunConverterhandles automatic parameter transformationAPI Endpoints:
client.beta.agents.create()- Create new agentsclient.beta.agents.get()- Retrieve agent by IDclient.beta.agents.list()- List all agentsclient.beta.agents.modify()- Update existing agentsclient.beta.agents.delete()- Delete agentsclient.beta.agents.runs.*- Direct access to maestro runs API with automatic agent integrationParameter Conversion Flow:
AgentToMaestroRunConverterconverts agent params + run params → maestro paramsRunResponsemodelBenefits:
Maintainability: Single source of truth for run execution logic in maestro
Type Safety: Pydantic handles all conversions with validation
Consistency: Same run behavior whether using agents or maestro directly
Simplicity: Clean delegation pattern with automatic parameter mapping
Extensibility: Easy to add new agent parameters through the conversion schema
Documentation Updates:
This PR includes comprehensive documentation in the README.md file under the "Agents (Beta)" section, providing:
Examples Added:
examples/studio/agents/agent_crud.py- Complete CRUD operationsexamples/studio/agents/agent_run.py- Basic agent executionexamples/studio/agents/async_agent_run.py- Async agent operationsThis implementation provides a unified agent experience while leveraging the robust maestro execution engine underneath.