Agents and Tool Calling
Build agentic workflows with function calling, multi-step reasoning, and tool use on Parasail.
Two approaches
Approach
Best for
API
Function calling with Chat Completions
from openai import OpenAI
import json
client = OpenAI(
base_url="https://api.parasail.io/v1",
api_key="<PARASAIL_API_KEY>"
)
tools = [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather for a city.",
"parameters": {
"type": "object",
"properties": {
"city": {"type": "string", "description": "City name"}
},
"required": ["city"]
}
}
}
]
response = client.chat.completions.create(
model="parasail-deepseek-r1",
messages=[{"role": "user", "content": "What's the weather in Tokyo?"}],
tools=tools
)
print(response.choices[0].message.tool_calls)Responses API (multi-turn agentic)
Relevant guides
API reference
Last updated