Run Agent
To execute the agents you deployed, you can use the following code. This API allows you to run a specific agent and perform its designated tasks. You can also specify the input data for the agent to process.
Agent Access Control (only for Teams and Enterprise plans): If you are using the Teams or Enterprise plan, you can set up access control for your agents. This allows you to restrict access to specific users or groups within your organization. You can manage access control settings through the SVAHNAR Platform.
Basic Execution (Without History)
Use this for single-turn tasks where context from previous messages is not required.
from svahnar import Svahnar
client = Svahnar()
response = client.agents.run(
agent_id="b06b8e39-51a7-4b6a-8474-e6340a6b9fa6",
message="Tell me about Stargate Project"
)
print(response)
Request Parameters
agent_id: The unique identifier of the agent you want to execute. This ID is assigned when you create the agent.message: The input data or message you want to send to the agent for processing. Currently it only supports string input.
Response
{
"response": [
"supervisor_agent_1" : {
}
],
"usage": {
"credits_charged": [
{
"agent_name": "Supervisor_agent_1",
"number_of_runs": 4,
"credit_consumed": 4
},
{
"agent_name": "Web_Search_Agent",
"number_of_runs": 2,
"credit_consumed": 2
},
{
"agent_name": "Content_Writing_Agent",
"number_of_runs": 1,
"credit_consumed": 1
}
],
"total_credits_charged": 7
},
"additional_metadata": {
"thread_id": "000000-00000-00000-00000"
}
}
The response may vary based on the agent's configuration and the input message provided. The example above is a sample output to illustrate the structure of the response. The actual content and the credits consumed may differ based on the agent's functionality and the input message.
Response Parameters
response: The main response from the agent, which includes the output generated by the agent based on the input message provided.usage: Information about the credits charged for the agent execution, including details about each agent involved in the process and the total credits consumed.