Quickstart¶
Install dependencies from PyPI:
For development installs (from a cloned repo):
You will also need at least:
OPENAI_API_KEYset in your environment for the language model backend.- (Optional)
TAVILY_API_KEYif you want the default research agent to use Tavily web search; otherwise it will fall back to a built-in DuckDuckGo-based search tool.
A simple .env file (used with python-dotenv) might look like:
Minimal usage (async):
import asyncio
from pydantask.agents import DeepAgent
async def main() -> None:
agent = DeepAgent(objective="Research the best open source LLMs of 2024.")
run_result = await agent.run() # DeepAgentRunResult
print("Objective:", run_result.objective)
if run_result.final_result is not None:
print("\nFinal summary:\n", run_result.final_result.summary)
print("\nFinal detailed output (truncated):\n")
print(run_result.final_result.detailed_output[:1000])
if __name__ == "__main__":
asyncio.run(main())
For more depth, see the Agent Concepts page.