Skip to content
  • Auto
  • Light
  • Dark

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.

You can create an agent endpoint access key in the settings of your agent in the console.

For example, you can access agent inference using the SDK:

Python
import os
from 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)

The async client uses the exact same interface.

Python
import os
from 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)