Agents: detailed guide
This page focuses on the agent-specific parts of the SDK: creation, configuration, access control, environment variables, tool integration, and common patterns. If you haven’t set up aKubiyaClient yet, see the Client Quick Start at Client Overview for initialization and authentication instructions.
Below are practical, in-depth examples and patterns for working with agents. The first example demonstrates creating a DevOps-focused agent and verifying the returned configuration.
Create an agent (devops-assistant example)
The example demonstrates creating a DevOps-focused agent, verifying it viaclient.agents.get, and inspecting returned fields such as uuid, name, llm_model, and tools.
client.agents.create and client.agents.get calls. Typical fields include uuid, name, llm_model, tools, integrations, and other configuration metadata.
You can verify the same on the platform dashboard under Agents.

Core Operations
Create Agent
Create a new agent. Required:name. Optional: description, llm_model, ai_instructions, tools, integrations, and environment.
List Agents
Retrieve a list of agents. Supports pagination and basic filtering viafilter_term, sort_by, and limit.
Get Agent Details
Fetch a single agent’s full configuration and metadata by UUID.Update Agent
Update an agent’s configuration. Pass only the fields you wish to change; useadd_tools/remove_tools for tool lists.
Delete Agent
Permanently remove an agent. This action cannot be undone; ensure you have the correct UUID.Access Control
Use the access subservice to view and modify who can interact with this agent (users and groups). Manage who can interact with your agents:View Access Settings
Inspect current access lists for an agent (users and groups).Add Users
Add specific user emails to the agent’s access allowlist.Add Groups
Add one or more groups to grant access to the agent (use your org’s group names).Remove Access
Remove specific users or clear group restrictions.Environment Variables
Manage environment variables that will be present when the agent runs. Use env to avoid hardcoding secrets or configuration. Configure agent environment:List Environment Variables
Retrieve the current key/value pairs set for the agent.Set Environment Variables
Set or update multiple environment variables for the agent. Values should be strings.Remove Environment Variables
Remove one or more environment variables from the agent’s runtime configuration.AI Instructions (Prompts)
Use the prompt API to set system-level instructions (a.k.a. system messages) that steer the agent’s LLM responses. Configure agent behavior with custom instructions:Set Instructions
Set or replace the agent’s instruction block. This text guides the agent’s behavior and should be concise but explicit.Get Current Instructions
Read back the currently configured instructions for the agent.Tool Management
Add or remove tool capabilities the agent can use when executing tasks. Tools are referenced by name. Manage agent capabilities:Add Tools
Grant additional tools to the agent. Tools enable actions (e.g.,kubectl, helm, terraform).
Remove Tools
List Available Tools
Error Handling
Service-level errors raised by the Agents API should be handled to provide clear user feedback.Complete Example
End-to-end example: create an agent, configure access and environment, and verify the agent is ready.Best Practices
Use Descriptive Names
Use Descriptive Names
Set Clear AI Instructions
Set Clear AI Instructions
Provide detailed instructions for consistent behavior:
Manage Access Control
Manage Access Control
Restrict agent access to appropriate teams:
Use Environment Variables
Use Environment Variables
Configure agents with environment variables instead of hardcoding: