Kortix Client
The main entry point for the SDK.Kortix
string
required
Your Kortix API key from settings/api-keys
string
default:"https://api.kortix.com/v1"
The API base URL. Override for local development or custom deployments.
client.Agent: Agent management interfaceclient.Thread: Thread management interface
Agent Management
Create and manage AI agents.Agent.create()
Create a new agent with specified configuration.string
required
A friendly name for the agent
string
required
Instructions that define the agent’s behavior and personality
list[KortixTools]
default:"[]"
List of tools (MCPTools or AgentPressTools) the agent can use
list[str] | None
default:"None"
Specific tool names to enable. If None, all tools are enabled.
Agent instance
Example:
Agent.get()
Retrieve an existing agent by ID.string
required
The unique identifier of the agent
Agent instance
Example:
Agent Instance
An Agent instance provides methods to interact with a specific agent.agent.run()
Execute the agent with a prompt on a thread.string
required
The user message/prompt to send to the agent
Thread
required
The thread context for the conversation
string
default:"anthropic/claude-sonnet-4-20250514"
Override the model for this specific run
AgentRun instance
Example:
agent.update()
Update agent configuration.string
New name for the agent
string
New system prompt
list[KortixTools]
New list of tools
list[str]
New list of allowed tool names
agent.details()
Get detailed information about the agent.AgentResponse with complete agent configuration
Thread Management
Create and manage conversation threads.Thread.create()
Create a new conversation thread.string
Optional name for the thread/project
Thread instance
Example:
Thread.get()
Retrieve an existing thread by ID.string
required
The unique identifier of the thread
Thread instance
Thread.delete()
Delete a thread.string
required
The unique identifier of the thread to delete
Thread Instance
A Thread instance provides methods to interact with a specific thread.thread.add_message()
Add a message to the thread.string
required
The message content to add
thread.del_message()
Delete a message from the thread.string
required
The ID of the message to delete
thread.get_messages()
Retrieve all messages in the thread.Message objects
Example:
thread.get_agent_runs()
Get all agent runs for this thread.AgentRun objects or None if no runs exist
Agent Run
Represents an execution of an agent.run.get_stream()
Get a stream of the agent’s response.Tools
MCPTools
Connect to custom MCP (Model Context Protocol) servers.string
required
The HTTP URL of the MCP server (e.g., “http://localhost:4000/mcp/”)
string
required
A friendly name for this MCP server
list[str]
Specific tool names to enable from this server
url: The MCP server endpointname: The server nametype: Always “http”enabled_tools: List of enabled tool names
AgentPressTools
Built-in tools provided by Kortix.Data Models
Message
Represents a message in a thread. Properties:message_id(str): Unique message identifierthread_id(str): Parent thread IDtype(MessageType): Type of message (user, assistant, tool, status)is_llm_message(bool): Whether this is an LLM-generated messagecontent(Any): Message content (varies by type)created_at(str): Creation timestampupdated_at(str): Last update timestampmetadata(Any): Additional metadata
message.is_user_message(bool): Check if user messagemessage.is_assistant_message(bool): Check if assistant messagemessage.get_content_as_string()(str): Get content as string
MessageType
Enum of message types:MessageType.USER: User messageMessageType.ASSISTANT: Assistant messageMessageType.TOOL: Tool resultMessageType.STATUS: Status updateMessageType.ASSISTANT_RESPONSE_END: End of assistant response
Role
Enum of message roles:Role.USER: User roleRole.ASSISTANT: Assistant roleRole.SYSTEM: System role
Utilities
print_stream()
Utility function to print agent response streams with formatting.- Colored output for different event types
- Tool usage detection and display
- XML formatting for structured content
- Progress indicators