airflow.providers.openai.operators.agent¶
Classes¶
Run one turn in a fresh OpenAI Managed Agents session and return its session ID. |
Module Contents¶
- class airflow.providers.openai.operators.agent.OpenAIAgentSessionOperator(*, input, environment, agent_id=None, session_kwargs=None, conn_id=OpenAIHook.default_conn_name, deferrable=conf.getboolean('operators', 'default_deferrable', fallback=False), poll_interval=10, timeout=3600, **kwargs)[source]¶
Bases:
airflow.providers.common.compat.sdk.BaseOperatorRun one turn in a fresh OpenAI Managed Agents session and return its session ID.
The session is retained for downstream retrieval of items and artifacts. A retry creates a new session and can repeat external side effects.
- Parameters:
input (str) – Initial user message. (templated)
environment (dict[str, Any]) – SDK environment configuration or template reference. (templated)
agent_id (str | None) – Saved agent ID. Alternatively supply agent.model in session_kwargs. (templated)
session_kwargs (dict[str, Any] | None) – Additional SDK session creation arguments, such as agent, vault_ids and metadata. Must not contain input, environment, agent_id or stream. (templated)
conn_id (str) – OpenAI connection ID. (templated)
deferrable (bool) – Release the worker while waiting for completion.
poll_interval (float) – Seconds between polls.
timeout (float) – Maximum seconds to wait for the initial turn. A shorter
execution_timeoutstill applies and preempts the cancel-on-timeout path.
- template_fields: collections.abc.Sequence[str] = ('input', 'environment', 'agent_id', 'session_kwargs', 'conn_id')[source]¶
- property hook: airflow.providers.openai.hooks.openai.OpenAIHook[source]¶
Return the connection’s OpenAI hook.
- execute(context)[source]¶
Derive when creating an operator.
The main method to execute the task. Context is the same dictionary used as when rendering jinja templates.
Refer to get_template_context for more context.