kaxil opened a new issue, #62826:
URL: https://github.com/apache/airflow/issues/62826
## AgentOperator + @task.agent
Bridge from simple LLM calls to agentic workflows with tool use and
multi-step reasoning.
### What
LLMOperator does prompt → response. AgentOperator lets the framework manage
tool-call loops, multi-turn reasoning, and autonomous decision-making. Users
build a pydantic-ai Agent (with tools, dependencies, validators) and the
operator runs it within Airflow's execution context.
### Design
- User provides a fully-configured pydantic-ai `Agent`; operator handles
lifecycle and XCom serialization
- `available_tools` for Airflow hook-based tools (hooks as agent tools,
leveraging 1000+ integrations)
- `max_iterations` to cap tool-call loop length and prevent runaway execution
- Budget integration via `AIBudget` for cost control
- `require_approval_for` specific tool calls (human-in-the-loop for
dangerous actions like writes, sends, deletes)
- Sandboxed execution with credential scoping — each agent runs with minimal
required privileges
- Decorator: `@task.agent(agent=my_agent)` for Pythonic usage
### Example
```python
from pydantic_ai import Agent
analyst_agent = Agent(
model="openai:gpt-4o",
tools=[query_database, read_s3_file],
system_prompt="You are a data analyst...",
)
@task.agent(agent=analyst_agent, llm_conn_id="openai_default")
def analyze_customer_data(segment: str):
return f"Analyze purchase patterns for {segment} customers"
```
### Dependencies
- LLMOperator (merged)
- PydanticAIHook (merged)
### Phase
Phase 2.5 — immediate follow-up to LLMOperator
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]