Create and manage agents

An agent must be active before it can process requests. Create and promote your agent using the operations below, then see Run an agent to start processing requests.

Create an agent

The most common properties of an agent you'll configure are:

name: A required string that identifies your agent.

instructions: Also known as a developer message or system prompt. Guides how the agent plans its actions and generates its response.

model_id: Which LLM to use as the base model.

tool_ids: IDs of the tools the agent can use. Create tools in the tool library first, then reference them here.

Endpoint: POST /v1/flow/agents/create Create agent

from seekrai.types import CreateAgentRequest, ReasoningEffort
from seekrai import SeekrFlow
api_key = "your_api_key"
client = SeekrFlow(api_key=api_key)

agent = client.agents.create(
    CreateAgentRequest(
        name="homework_tutor_bot",
        instructions="You are a tutor bot for middle schoolers. Answers the questions in a way middle schoolers can understand",
        model_id="meta-llama/Llama-3.3-70B-Instruct",
        tool_ids=[],
        reasoning_effort=ReasoningEffort.SPEED_OPTIMIZED

    )
)
print(f"Agent created with ID: {agent.id}")
print(f"Agent status: {agent.status}")
ℹ️

Note

Agents can be configured to use any base or fine-tuned model available on the SeekrFlow platform.

For details on agent status, see Agent status.

Write effective instructions

When writing your agent’s instructions, follow these best practices:

  1. Define role, goal, and context. Clearly state the agent’s persona, objective, and any relevant background. Example: “You are a procurement research assistant tasked with finding active government contracts based on user input.”

  2. Be specific and prescriptive. Break complex tasks into simpler subgoals and specify how each tool should be used. Example: “Use the search_contracts tool only after collecting both a state and keyword.”

  3. Call out edge cases explicitly. If the agent should not respond to certain queries, say so directly. Example: “Do not answer legal or compliance questions — respond with: ‘I’m not able to help with that.’”

  4. Specify output format. If not using structured outputs, be clear about the desired format and tone. Example: “Respond in a numbered list with no more than 3 items. Use plain language and avoid technical jargon.”

Configure reasoning effort

SeekrFlow agents support two distinct reasoning modes, each optimized for different use cases and performance requirements. The reasoning effort level determines how the agent processes information, plans its actions, and selects appropriate tools to accomplish tasks.

  • ReasoningEffort.SPEED_OPTIMIZED: Designed for low-latency applications, this mode uses streamlined reasoning processes that consume fewer computational resources while generating the agent's execution plan. This approach prioritizes quick response times and is ideal for scenarios where immediate feedback is critical and the agent has access to a limited set of tools.
  • ReasoningEffort.PERFORMANCE_OPTIMIZED: Built for complex scenarios requiring deeper analytical processing, this mode employs enhanced reasoning capabilities to handle intricate decision-making and tool selection. This approach is essential for agents managing multiple tools or executing sophisticated workflows where accuracy and thoroughness outweigh response speed considerations.

We recommend experimenting with both reasoning modes during agent development to determine the optimal configuration for your specific use case. Generally, SPEED_OPTIMIZED performs well for latency-sensitive applications with simple tool sets, while PERFORMANCE_OPTIMIZED is necessary for agents utilizing extensive tool arrays to ensure consistent, reliable results.

List your agents and their status

To list all of the agent's you've created and their associated status, you can use the below code snippet:

Endpoint: GET /v1/flow/agents/ List agents

available_agents = client.agents.list_agents()

print("Available agents:")
for agent in available_agents:
    print(f"ID: {agent.id}, Name: {agent.name}, Status: {agent.status}")

Update an agent

Use agents.update to make partial changes to an existing agent. Provide only the fields you want to change. Omitted fields remain unchanged.

Endpoint: PATCH /v1/flow/agents/{agent_id} Update agent

from seekrai.types import UpdateAgentRequest

updated_agent = client.agents.update(
    agent_id=agent.id,
    request=UpdateAgentRequest(
        instructions="You are a tutor bot for high schoolers. Answer questions in a way high schoolers can understand."
    )
)
print(f"Agent updated: {updated_agent.id}")
ParameterDescription
nameUpdated agent name.
instructionsUpdated system prompt.
tool_idsUpdated list of tool IDs. Replaces the existing list.
model_idUpdated base model.
reasoning_effortUpdated reasoning effort.
planner_temperatureUpdated planner temperature.
ℹ️

Note

Agents in Inactive or Failed states remain in their current state after an update. To activate an updated agent, promote it manually.

Preview an agent update

Use agents.update_diff to simulate an update without applying it. The response shows exactly what would change.

Endpoint: PATCH /v1/flow/agents/{agent_id}/diff Preview agent update

from seekrai.types import UpdateAgentRequest

diff = client.agents.update_diff(
    agent_id=agent.id,
    request=UpdateAgentRequest(
        name="homework_tutor_bot_v2",
        instructions="You are a tutor bot for high schoolers."
    )
)
print(diff)

The response includes the complete before and after agent state, and a diff object identifying each changed field:

AgentDiffResponse(
    before=...,
    after=...,
    diff={
        "name": {
            "before": "homework_tutor_bot",
            "after": "homework_tutor_bot_v2"
        },
        "instructions": {
            "before": "You are a tutor bot for middle schoolers...",
            "after": "You are a tutor bot for high schoolers."
        }
    }
)

Promote an agent

ℹ️

Note

Agent create requests will promote an agent automatically. Agents only need to be promoted after they've been demoted and are in an inactive state.

Endpoint: PUT /v1/flow/agents/{agent_id}/promote Promote agent

agent = client.agents.promote(agent.id)
print(f"Agent promoted. Agent ID: {agent.id}")

When promoting an agent that has sub-agents linked as tools, SeekrFlow automatically promotes the sub-agents first. The supervisor remains in Pending state until all sub-agents are ready.

Demote an agent

Demoting an agent moves it to an inactive state. This is useful when you want to retain the agent's definition without allowing it to handle inference requests.

Endpoint: PUT /v1/flow/agents/{agent_id}/demote Demote agent

agent = client.agents.demote(agent.id)
print(f"Agent demoted. Agent ID: {agent.id}")
ℹ️

Note

Demoting a supervisor does not automatically demote its sub-agents. Each sub-agent must be demoted individually if needed. A sub-agent cannot be demoted while it is still linked to an active supervisor—demote the supervisor first, or unlink the sub-agent. See Agent as tool for details.

Delete an agent

This permanently removes an agent from the SeekrFlow platform.

Endpoint: DELETE /v1/flow/agents/{agent_id} Delete agent

del_response = client.agents.delete(agent.id)
print(f"Agent deleted. Agent ID: {agent.id}")
ℹ️

Note

Deleting a supervisor does not affect its sub-agents or their agent-as-tool wrappers. To delete a sub-agent, first unlink it from any supervisors and delete its associated agent-as-tool.