Repository navigation
feat: Agents as code: Agent builder, agents.push/pull and CLI project layout - #939
Conversation
PR SummaryMedium Risk Overview Workflows now accept Sync and async clients share one generator-based push/pull implementation; README documents the feature. Large test suite with an in-memory fake API and CLI fixture round-trips. Reviewed by Cursor Bugbot for commit 40588cd. Bugbot is set up for automated code reviews on this repo. Configure here. |
…out) Port of the JS agents-as-code Agent builder: one Agent definition composing settings, tools and a workflow; client.conversational_ai.agents.push()/pull() on the sync and async clients; AgentProject reading and writing the ElevenLabs CLI's project files; workflow tool nodes accepting Tool objects. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- tool_definition(): strip unmodeled keys inside Optional unions of models (such as an array's items), so a tool rebuilt in code still matches the stored copy and push doesn't PATCH it needlessly. - Workflow tool nodes: two different Tool objects with the same name in one node's list are now a duplicate_tool_name issue. - Workflow.to_json_string() takes tool_ids, like to_json(). Co-Authored-By: Claude Opus 5.5 <[email protected]>
bbc3347 to
2e3e866
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2e3e866. Configure here.
…on 3.8 - push(branch_id=...) without a project now reads the branch's config and gets its tools by id. The tools API's used_by_agent_id covers the main branch only, so a branch push could update a main-branch tool of the same name and report main-branch tools as detached. - tool_definition(): resolve forward references to generated types, which Python 3.8 leaves unresolved in model annotations, so unmodeled keys inside Optional unions are stripped there too (fixes the 3.8 CI failure). Co-Authored-By: Claude Opus 5.5 <[email protected]>

Summary
Python port of the agents-as-code
Agentbuilder from elevenlabs/elevenlabs-js#497, whose shape was approved there. OneAgentdefinition brings together an agent's settings, its tools and its workflow.client.conversational_ai.agents.push(agent)then creates or updates the agent and every tool it uses.AgentProjectkeeps agents in the ElevenLabs CLI's project files, so one repo works with both the SDK andelevenlabs agents push.Usage
AsyncElevenLabshas the samepushandpull, which youawait.Details
What's ported: everything in the JS PR, including its review fixes.
Agentbuilder:conversation_config/platform_settings, conflict detection;built_in_tools;pushmatches tools by recorded id with a project, and otherwise by name among the tools the agent already uses;unchangedand send no request; tools the agent stops using are reported asdetached, never deleted;AgentPushErrorcarries the partial result;pulluses the CLI's config shape.AgentProjectin the CLI layout: 0600 file permissions,O_NOFOLLOW, paths kept inside the project, and the CLI's formatting and file naming.tool_idsacceptToolobjects.Workflow.from_json(data, tools_by_id=...)swaps ids forToolobjects through a module-private function.ConversationalConfig, and the wire path is read from the serialized piece. Field names the model doesn't declare are rejected, so a wrong name fails instead of being a hand-typed snake_case path.Where Python differs from JS:
build()returns a TypedDict. The Python SDK has no generated create-agent request model, sobuild()returns a TypedDict of generated models, used asagents.create(**agent.build(tool_ids=...)).additional_body_parameterswhen the request is a pydantic model. Tool create and update therefore send{"tool_config": wire}. Agent create and update send typed kwargs plus the full config as extra body parameters, as in JS..dict()would fill in model defaults, which would then end up in pulled config files.temperature, is reported as aninvalid_configissue instead of raising.AgentProjectreads and writes files synchronously, including when called from the async client.Overlap: #938 also changes
agent_workflows/graph.pyandworkflow.py. Whichever PR merges second will need a rebase.Testing
pytest tests/agent_builder tests/agent_tools tests/agent_workflows: 197 passed. That is 51 new agent tests, 3 new workflow tests, and the 143 that were already there.MockTransport). They cover:pushandpull;test_client_tool_decorator.py) pass with both pydantic 2.10 and 1.10: 178 each.ruff checkandmypyon the new and changed modules: clean.🤖 Generated with Claude Code