🚨 Open Responses API (Alpha). Learn more here
Learn how to use tools and integrations with the Python SDK
# Add web search capability to an agent client.agents.tools.create( agent_id=agent.id, name="web_search", type="integration", integration={ "provider": "brave", "method": "search", "setup": { "brave_api_key": "your_brave_api_key" } } )
# Add email capability client.agents.tools.create( agent_id=agent.id, name="send_email", type="integration", integration={ "provider": "email", "setup": { "host": "smtp.gmail.com", "port": 587, "user": "your_email@gmail.com", "password": "your_app_password" } } )
# Define a custom tool client.agents.tools.create( agent_id=agent.id, name="calculate_price", type="function", function={ "description": "Calculate total price including tax", "parameters": { "type": "object", "properties": { "base_price": { "type": "number", "description": "Base price before tax" }, "tax_rate": { "type": "number", "description": "Tax rate as a decimal" } }, "required": ["base_price", "tax_rate"] } } )
# Add document management capability client.agents.tools.create( agent_id=agent.id, name="manage_docs", type="system", system={ "resource": "agent", "subresource": "doc", "operation": "create" } )
# Add external API integration with params_schema client.agents.tools.create( agent_id=agent.id, name="weather_api", type="api_call", api_call={ "method": "GET", "url": "https://api.weather.com/v1/current", "headers": { "Authorization": "Bearer {{env.WEATHER_API_KEY}}" }, "params_schema": { "type": "object", "properties": { "location": { "type": "string", "description": "City name or coordinates" }, "units": { "type": "string", "enum": ["metric", "imperial"], "description": "Temperature units" } }, "required": ["location"] } } )
name: Research Assistant description: Research and summarize topics tools: - name: web_search type: integration integration: provider: brave method: search - name: send_email type: integration integration: provider: email - name: calculate_price type: function function: parameters: type: object properties: base_price: type: number tax_rate: type: number main: - tool: web_search arguments: query: _.topic - tool: calculate_price arguments: base_price: 100 tax_rate: 0.1 - tool: send_email arguments: to: _.email subject: "Research Results" body: _.summary
from julep.exceptions import ToolError, IntegrationError try: result = client.executions.create(task_id=task.id) except ToolError as e: print(f"Tool execution failed: {e}") except IntegrationError as e: print(f"Integration error: {e}")