Agent Inference
Gradient allows you to create multi-agent workflows to power your AI applications. This allows developers to integrate agents into your AI applications.
Endpoint Access Keys
Section titled “Endpoint Access Keys”You can create an agent endpoint access key in the settings of your agent in the console.
Examples
Section titled “Examples”Sync Client
Section titled “Sync Client”For example, you can access agent inference using the SDK:
import osfrom do_gradientai import GradientAI
agent_client = GradientAI( agent_key=os.environ.get("GRADIENTAI_AGENT_KEY"), agent_endpoint="https://my-agent.agents.do-ai.run",)
agent_response = agent_client.agents.chat.completions.create( messages=[ { "role": "user", "content": "What is the capital of Portugal?", } ], model="ignored",)
print(agent_response.choices[0].message.content)
Async Client
Section titled “Async Client”The async client uses the exact same interface.
import osfrom do_gradientai import AsyncGradientAI
agent_client = AsyncGradientAI( agent_key=os.environ.get("GRADIENTAI_AGENT_KEY"), agent_endpoint="https://my-agent.agents.do-ai.run",)
agent_response = await agent_client.agents.chat.completions.create( messages=[ { "role": "user", "content": "What is the capital of Portugal?", } ], model="ignored",)
print(agent_response.choices[0].message.content)