from codegen import Agent# Initialize the Agent with your organization ID and API tokenagent = Agent(org_id="...", token="...")# Run an agent with a prompttask = agent.run(prompt="Leave a review on PR #123")# Check the initial statusprint(task.status)# Refresh the task to get updated status (tasks can take time)task.refresh()if task.status == "completed": print(task.result) # Result often contains code, summaries, or links
Codegen agents can research code, create PRs, modify Linear tickets, and more.
The Codegen SDK is your gateway to programmatically interacting with your AI Software Engineer. You can use it to:
Automate development tasks: Assign tasks like implementing features, fixing bugs, writing tests, or improving documentation to the agent.
Integrate AI into your workflows: Trigger agent tasks from your CI/CD pipelines, scripts, or other development tools.
Provide context and guidance: Supply the agent with specific instructions, relevant code snippets, or background information to ensure it performs tasks according to your requirements.
Essentially, the SDK allows you to leverage Codegen’s AI capabilities wherever you can run Python code.