Build an agent with the ADK
This guide walks through how to go from a blank slate to a production-ready voice agent using Agent Studio, the PolyAI ADK, and optionally a coding tool such as Claude Code.
There are two common ways to build with the ADK:
| Workflow | Description |
|---|---|
| CLI workflow | The hands-on developer path. You run the commands yourself, edit files locally, and push changes back to Agent Studio. |
| AI-agent workflow | You provide a brief; a coding tool uses the ADK to generate and push the project files on your behalf. |
-
You provide context
Gather the requirements, business rules, API information, and reference material.
-
The agent or developer builds
Using the ADK, the project files are created, edited, validated, and prepared locally.
-
Agent Studio hosts and deploys
The generated work is pushed back into Agent Studio, where it can be reviewed, merged, and deployed.
Architecture at a glance¶
| Role | Responsibility |
|---|---|
| You | Provide requirements, project context, and business rules |
| PolyAI ADK | Connect the local project to Agent Studio and manage sync, validation, and tooling |
| Coding agent | Optionally generate and update files using the ADK |
| Agent Studio | Host, preview, review, merge, and deploy the agent |
Local project structure¶
When an Agent Studio project is linked locally, it follows this general structure:
<account>/<project>/
├── agent_settings/
│ ├── personality.yaml
│ ├── role.yaml
│ ├── rules.txt
│ └── experimental_config.json
├── config/
│ ├── entities.yaml
│ ├── handoffs.yaml
│ ├── sms_templates.yaml
│ └── variant_attributes.yaml
├── voice/
│ ├── configuration.yaml
│ ├── speech_recognition/
│ │ ├── asr_settings.yaml
│ │ ├── keyphrase_boosting.yaml
│ │ └── transcript_corrections.yaml
│ └── response_control/
│ ├── pronunciations.yaml
│ └── phrase_filtering.yaml
├── chat/
│ └── configuration.yaml
├── flows/
│ └── {flow_name}/
│ ├── flow_config.yaml
│ ├── steps/
│ │ └── {step_name}.yaml
│ ├── function_steps/
│ │ └── {function_step}.py
│ └── functions/
│ └── {function_name}.py
├── functions/
│ ├── start_function.py
│ ├── end_function.py
│ └── {function_name}.py
├── topics/
│ └── {topic_name}.yaml
└── project.yaml
This structure mirrors the parts of the agent that Agent Studio understands: settings, flows, functions, topics, channel configuration, and supporting resources.
Workflow 1 - CLI workflow¶
The CLI workflow is the manual developer path. You use the ADK directly, edit the project locally, and push changes back to Agent Studio.
Step 1 - Initialise your project¶
Link a local folder to an existing Agent Studio project. The agent must already exist in Agent Studio.
This creates the local project structure and writes the metadata needed to connect the folder to Agent Studio.
Step 2 - Pull remote config and set up the environment¶
Pull the current configuration into your local project.
At this point, configure any API keys or environment variables needed for the project.
Run commands from the project folder
All CLI commands should be run from within the local project folder, unless you explicitly use the relevant path flag.
Step 3 - Run the agent locally¶
Start an interactive chat session to confirm the connection works and inspect runtime behavior.
Chat runs against main on Sandbox
poly chat connects to the main branch of your Sandbox environment in Agent Studio — not your local files, and not your current feature branch. At this stage it is useful for confirming the connection works. To chat against your own changes, push and merge your branch in Agent Studio first.
Step 4 - Review the docs and understand the SDK¶
Use the CLI docs command to inspect the available resources and learn how they fit together.
Resource-specific documentation is available for agent settings, voice settings, chat settings, flows, functions, topics, entities, handoffs, variants, SMS templates, variables, speech recognition, response control, and experimental config.
Step 5 - Customise the agent¶
This is the core build phase. Create a branch, edit resources locally, track changes, and push them back.
Branching¶
Functions¶
Create or modify backend functions the agent calls at runtime.
Typical locations include:
- global functions under the functions directory
- lifecycle hooks such as start and end functions
- flow-scoped functions
- function steps inside flows
Topics¶
Add or edit knowledge-base topics used for retrieval.
Agent settings¶
Update the personality, role, and rules that define the agent’s global behavior.
Flows¶
Build conversation flows, including prompts, step transitions, entities, and function steps.
Channel-specific settings¶
Adjust greeting messages, disclaimers, and style prompts for voice and chat.
Handoffs, SMS, and variants¶
Define escalation paths, SMS templates, and per-variant configuration.
ASR and response control¶
Tune speech recognition and control TTS behavior.
Experimental config¶
Enable or tune experimental features where needed.
Step 6 - Track and validate changes¶
Inspect the local changes before pushing.
poly status
poly diff
poly diff <file>
poly validate
poly format
poly revert --all
poly revert <file>
Step 7 - Push changes¶
Push the local changes back to Agent Studio.
Step 8 - Test against sandbox¶
Once your branch is merged in Agent Studio, test the agent by chatting with it against the Sandbox environment.
Merge before chatting
poly chat connects to the main branch of your Sandbox — not your feature branch. Push your changes with poly push, merge the branch in Agent Studio, then run poly chat.
Step 9 - Iterate on quality¶
Review, refine, and test again. You can also use the review command to share diffs with teammates.
Make test calls, inspect transcripts, refine prompts, flows, and functions, and then re-push.
Step 10 - Deploy to production¶
Once the changes are pushed and validated, merge the branch in Agent Studio and deploy the project.
Step 11 - Monitor performance¶
Use Agent Studio analytics to monitor containment, CSAT, handle time, and flagged transcripts. Pull changes back locally as needed and continue iterating.
Workflow 2 - AI-agent workflow¶
The AI-agent workflow uses a coding tool such as Claude Code to run the same development loop on your behalf.
-
You provide the brief
Requirements, business rules, integrations, and API documentation.
-
The coding tool generates the project
It uses the ADK to read documentation, generate files, and push the result.
-
You review and deploy
Agent Studio remains the place where the work is checked, merged, and deployed.
No manual flow-building required
In this workflow, the coding tool generates the project files. Agent Studio is where the output is reviewed, tested, and deployed.
Step 1 - Gather requirements¶
Collect the project context before you begin.
Include anything the coding tool will need to produce a working agent:
- API endpoint URLs
- business rules
- use-case descriptions
- internal notes or emails
- reference material
- links to API documentation
The more complete and structured your input is, the less correction the output requires.
Front-load the context
Gather everything up front. Providing context piecemeal produces piecemeal output.
Step 2 - Create a new project in Agent Studio¶
Open Agent Studio and create a brand-new project.
The project starts empty:
- no knowledge base
- no flows
- no configuration
That blank starting point is intentional. The coding tool populates the project in later steps.
Think of Agent Studio as the deployment target
Agent Studio is where the project lives, but the coding tool generates the actual content.
Step 3 - Start the coding tool via the CLI¶
Open your terminal and start the coding tool.
At this stage:
- the ADK must already be installed
- the Agent Studio project must already exist
- the coding tool should initialize and link the project using the ADK
The ADK acts as the bridge between your local environment and Agent Studio. It lets the coding tool read from and write back to the project.
Step 4 - Give the coding tool its context¶
Provide the coding tool with the information you gathered earlier.
Include:
- project-specific requirements
- the URL to the business’s public API documentation
- relevant internal context
- useful patterns or best practices from previous projects
Use the docs command to generate a reference file the coding tool can read:
Step 5 - Generate the project files¶
Once the context is in place, the coding tool generates the project files.
This produces the assets the agent needs, including:
-
Conversation flows
Dialogue logic and routing for the agent.
-
Callable functions
Backend functions used during calls.
-
Knowledge base entries
Information the agent can reference when answering questions.
-
API integrations
Both real API connections and mock endpoints for testing.
The generated files follow ADK structure and are ready to push to Agent Studio.
Step 6 - Push to Agent Studio¶
Once the files are generated, use the ADK to push them to Agent Studio.
A new branch is created in the project so the generated work can be reviewed safely before anything goes live.
When you switch to that branch in Agent Studio, you should see the generated changes, such as:
- updated greeting messages
- new knowledge base entries
- a built tracking flow
- real and mock API integrations
Use the branch review step
The branch-based workflow makes it possible to inspect what was generated before merging it into the main project.
Step 7 - Review, merge, and deploy¶
Review the generated work inside Agent Studio.
Check that the key parts of the agent look correct:
- flows
- functions
- knowledge base entries
- API integrations
Once everything looks right:
- merge the branch into the main project
- deploy the project
At that point, the agent is live.
CLI command overview¶
| Command | Description |
|---|---|
| poly init | Initialise a new project locally |
| poly pull | Pull remote config into the local project |
| poly push | Push local changes to Agent Studio |
| poly status | List changed files |
| poly diff | Show diffs |
| poly revert | Revert local changes |
| poly branch | Branch management |
| poly format | Format resource files |
| poly validate | Validate project configuration locally |
| poly review | Create a diff review page |
| poly chat | Start an interactive session with the agent |
| poly docs | Output resource documentation |
The overall loop¶
- create or connect a project
- build locally using the ADK
- push to Agent Studio
- review, merge, and deploy
Next steps¶
-
CLI reference
Explore the available ADK commands and options.
-
Walkthrough video
See the workflow demonstrated in video form.