Skip to content

Extraction Agent

ExtractionAgent

ExtractionAgent(session_id)

Bases: Agent

Agent for extracting structured resume data from unstructured text.

Uses OpenAI Agents framework with a Jinja2 template to guide the extraction process. The agent analyzes resume text and returns structured data matching the ExtractionAgentResponse schema.

Attributes:

Name Type Description
template

Jinja2 template containing extraction instructions.

session_id

Unique session identifier for conversation tracking.

Example
agent = ExtractionAgent(session_id="session-123")
response = await Runner.run(agent, resume_text, session=session)
resume_data = response.final_output

Initialize the extraction agent.

Parameters:

Name Type Description Default
session_id str

Unique identifier for this extraction session.

required
Source code in bitonicai/agent/extraction_agent.py
def __init__(self, session_id: str):
    """Initialize the extraction agent.

    Args:
        session_id: Unique identifier for this extraction session.
    """
    self.template = load_template("extraction.md")
    self.session_id = session_id
    # Use non-strict JSON schema since we have dict[str, Any] fields
    super().__init__(
        name="Extraction Agent", instructions=self.template, output_type=ExtractionAgentResponse
    )

Functions