Use this file to discover all available pages before exploring further.
Definable fully supports async tool functions. Use them when your tool performs I/O operations like HTTP requests, database queries, or file operations.
Performs any I/O that benefits from non-blocking execution
@toolasync def search_and_summarize(query: str) -> str: """Search multiple sources and combine results.""" async with httpx.AsyncClient() as client: results = await asyncio.gather( client.get(f"https://api1.example.com/search?q={query}"), client.get(f"https://api2.example.com/search?q={query}"), ) return "\n".join(r.text[:200] for r in results)
You can freely mix sync and async tools on the same agent. The runtime handles both:
@tooldef calculate(expression: str) -> str: """Evaluate a math expression (sync — no I/O needed).""" return str(eval(expression))@toolasync def fetch_data(url: str) -> str: """Fetch data from a URL (async — I/O bound).""" async with httpx.AsyncClient() as client: resp = await client.get(url) return resp.textagent = Agent( model=OpenAIChat(id="gpt-4o"), tools=[calculate, fetch_data], # Both work together)