Execute 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.
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": {
"next": "Web_Search_Agent"
}
},
{
"Web_Search_Agent": {
"messages": [
{
"content": "It seems there was an error while trying to write the content to a text file. However, I can provide you with the content here, and you can manually save it to a text file if you wish.\n\n### Content for the Text File\n\n```\nOverview of the Stargate Project\n\n- Announcement: The Stargate Project was formally announced on January 21, 2025, by U.S. President Donald Trump.\n- Partnership: It is a joint venture involving OpenAI, SoftBank, Oracle, and investment firm MGX.\n- Investment: The project plans to invest up to $500 billion in AI infrastructure in the United States over the next four years.\n- Goals: The initiative aims to enhance AI innovation, secure American leadership in AI, create hundreds of thousands of jobs, and generate significant economic benefits globally.\n\nInfrastructure Development\n\n- Data Centers: The project will involve the construction of multiple large-scale data centers across the U.S., with initial investments focusing on two data centers in Abilene, Texas.\n- Funding: An initial $100 billion is being deployed immediately for the construction of these facilities, with plans for additional funding as the project progresses.\n\nStrategic Importance\n\n- National Security: The Stargate Project is positioned not only as an economic initiative but also as a strategic capability to protect national security.\n- Healthcare Impact: The project is expected to have transformative effects on healthcare technology, particularly in cancer research and treatment.\n\nKey Participants\n\n- Leadership: SoftBank's CEO, Masayoshi Son, will serve as the chairman of the venture.\n- Collaboration: OpenAI is looking to partner with various firms across the data center infrastructure landscape, including those involved in power, land, construction, and equipment.\n```\n\nYou can copy this text into a text editor (like Notepad or TextEdit) and save it as a `.txt` file. If you need further assistance, feel free to ask!"
}
]
}
},
{
"Supervisor_agent_1": {
"next": "Web_Search_Agent"
}
},
{
"Web_Search_Agent": {
"messages": [
{
"content": "I encountered an issue while trying to write the content to a text file. However, I can provide you with the content here, and you can easily copy it into a text file on your own. \n\n### Content for the Text File\n\n```\n### Stargate Project Overview\n\n- **Announcement**: The Stargate Project was formally announced on January 21, 2025, by U.S. President Donald Trump.\n- **Partnership**: It is a joint venture involving OpenAI, SoftBank, Oracle, and investment firm MGX.\n- **Investment**: The project plans to invest up to $500 billion in AI infrastructure in the United States by 2029.\n- **Goals**: The initiative aims to enhance AI innovation, secure American leadership in AI, create hundreds of thousands of jobs, and generate significant economic benefits globally.\n\n### Infrastructure Development\n\n- **Data Centers**: The project will involve the construction of multiple large-scale data centers across the U.S., with initial investments focusing on two data centers in Abilene, Texas.\n- **Funding**: An initial $100 billion is being deployed immediately for the construction of these facilities, with plans for additional funding as the project progresses.\n\n### Strategic Importance\n\n- **National Security**: The Stargate Project is positioned not only as an economic initiative but also as a strategic capability to protect national security.\n- **Healthcare Impact**: The project is expected to have transformative effects on healthcare technology, particularly in cancer research and treatment.\n\n### Key Participants\n\n- **Leadership**: SoftBank's CEO, Masayoshi Son, will serve as the venture's chairman.\n- **Collaboration**: OpenAI is looking to partner with various firms across the data center infrastructure landscape, including those involved in power, land, construction, and equipment.\n\n### Sources\n1. [Stargate LLC - Wikipedia](https://en.wikipedia.org/wiki/Stargate_LLC)\n2. [Energy Demands for OpenAI's Stargate Project - Certrec](https://www.certrec.com/blog/energy-demands-for-openai-stargate-project/)\n3. [Stargate AI explained: What's in the $500 billion project - TechTarget](https://www.techtarget.com/whatis/feature/Stargate-AI-explained-Whats-in-the-project)\n4. [Announcing The Stargate Project | OpenAI](https://openai.com/index/announcing-the-stargate-project/)\n5. [Stargate AI Project: The $500 Billion Gamble To Dominate The Future - Forbes](https://www.forbes.com/sites/emilsayegh/2025/01/22/stargate-ai-project-the-500-billion-gamble-to-dominate-the-future/)\n```\n\nYou can copy this text into a text editor (like Notepad or TextEdit) and save it as a `.txt` file. If you need any further assistance, feel free to ask!"
}
]
}
},
{
"Supervisor_agent_1": {
"next": "Content_Writing_Agent"
}
},
{
"Content_Writing_Agent": {
"messages": [
{
"content": "The content about the Stargate Project has been successfully written to a text file named `output.txt`. If you need further assistance or have any other requests, feel free to ask!"
}
]
}
},
{
"Supervisor_agent_1": {
"next": "__end__"
}
}
],
"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
}
}
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.
Writer tools will be available soon.
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.