02 create agent basics

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/22

flashcard set

Earn XP

Description and Tags

Last updated 6:40 PM on 8/2/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

23 Terms

1
New cards

What do you pass to create_agent to choose a model?

A model identifier string ("provider:model") or an initialized model instance.

2
New cards

What does the system_prompt parameter accept?

A string or a SystemMessage.

3
New cards

What does response_format do?

Lets you specify a pydantic model so the agent returns a validated response in the required format.

4
New cards

What does .invoke() do?

Runs the full ReAct loop from start to end and returns the final result.

5
New cards

What is the washing machine analogy for .invoke()?

You load the laundry (prompt + tools), pick a mode (response_format), and the machine runs the whole cycle until it returns clean laundry (result).

6
New cards

What is structured_response?

The field holding the validated final answer in the requested format.

7
New cards

What do you pass along with a new message to let the agent persist and resume conversation history?

A thread_id.

8
New cards

What practical benefit does State provide?

persisting context/data across multiple steps or turns

9
New cards

What practical benefit does Checkpointing provide?

Multi-turn dialogue across different .invoke() calls.

10
New cards

What should you pass as context for, and alongside what?

To pass per-run configuration (user ID, API keys, feature flags) to tools and middleware, passed alongside config.

11
New cards

What does the config layer store, and for what purpose?

Infrastructure settings, for execution control (thread_id, callbacks, tags).

12
New cards

What does the state layer store?

Conversation history — messages, memory, intermediate results.

13
New cards

What context_schema gives you:

(TVITC) typing validation isolation testability concurrency

14
New cards

What is the difference between what thread_id and context scope?

thread_id scopes the conversation (message history, checkpoints), while context carries per-run data read by tools and middleware at invocation time.

15
New cards

what is streaming

Streaming is the continuous, real-time transmission of data—such as tokens, audio, or video—allowing users to process or consume content immediately as it arrives rather than waiting for the entire payload to download.

16
New cards

Why is streaming needed if an agent makes multiple tool calls?


Because invoke only returns the final response at the end, and users often need progress updates before completion.

17
New cards

What does stream_events() let you do

See intermediate steps in real time.

18
New cards

What is a snapshot in streaming

The agent's state at a given step.

19
New cards
agent = create_agent(model="openai:gpt-5.5", tools=tools, ________=Answer)

agent = create_agent(model="openai:gpt-5.5", tools=tools, response_format=Answer)

20
New cards
config = {"configurable": {________: str(uuid7())}}

config = {"configurable": {"thread_id": str(uuid7())}}

21
New cards
agent = create_agent(model="openai:gpt-5.5", tools=[], ________=Context, checkpointer=InMemorySaver())

agent = create_agent(model="openai:gpt-5.5", tools=[], context_schema=Context, checkpointer=InMemorySaver())

22
New cards
result = agent.invoke({"messages": [{"role": "user", "content": "What's the weather in San Francisco?"}]}, config={"configurable": {"thread_id": str(uuid7())}}, ________=Context(user_id="user-123"))

result = agent.invoke({"messages": [{"role": "user", "content": "What's the weather in San Francisco?"}]}, config={"configurable": {"thread_id": str(uuid7())}}, context=Context(user_id="user-123"))

23
New cards
stream = agent.________({"messages": [{"role": "user", "content": "Search for AI news and summarize the findings"}]}, version="v3")

stream = agent.stream_events({"messages": [{"role": "user", "content": "Search for AI news and summarize the findings"}]}, version="v3")