Agentic Patterns

Build the six architectural patterns of agentic AI (prompt chaining, routing, parallelization, tool use, evaluator-optimizer, orchestrator-worker) and the ReAct and planning strategies as Pixeltable tables and computed columns.

Agents · Notebook · Updated

Colab runs it in your browser. If it calls a model provider, it asks for that provider's API key in a cell.

What it covers

  • Pattern 1: Prompt Chaining
  • Pattern 2: Routing
  • Pattern 3: Parallelization
  • Pattern 4: Tool Use
  • Pattern 5: Evaluator-Optimizer
  • Pattern 6: Orchestrator-Worker
  • Strategy A: ReAct
  • Strategy B: Planning

What it uses

Install
terminal
pip install pixeltable openai
Environment variables it names
OPENAI_API_KEY
Pixeltable calls
openai.chat_completions()openai.invoke_tools()pxt.create_table()@pxt.udfpxt.tools()pxt.udf()add_computed_column()insert()

A look at the code

agentic-patterns.ipynb
# Step 1: generate an outline
chain.add_computed_column(
outline_response=openai.chat_completions(
messages=[
{
'role': 'user',
'content': 'Create a 3-point outline for a short article about: '
+ chain.topic,
}
],
model='gpt-4o-mini',
)
)
chain.add_computed_column(
outline=chain.outline_response.choices[0].message.content.astype(
pxt.String
)
)

One cell of the notebook, copied as it is. Open it in Colab for the rest.

Browse all 103
  • LLM as judge

    Score model output with a second model, as a chain of computed columns

    Recipe · Updated
  • Document Indexing and RAG

    In this tutorial, we'll demonstrate how RAG operations can be implemented in Pixeltable. In particular, we'll develop a RAG application that summarizes a collection of PDF documents and uses ChatGPT to answer questions about them.

    Updated Open in Colab