Skip to content

Conversation

@jennsun
Copy link
Contributor

@jennsun jennsun commented Jan 16, 2026

Added thread-scoped/short term memory features to our agent langgraph as a stateful agent example

Note: frontend e2e-chatbot-app interface does not support passing in custom input/thread id, only invocation calls on the endpoint. Have filed a ticket to support passing in chatcontext via frontend interface so we can use conversation id as thread id

example app: https://eng-ml-agent-platform.staging.cloud.databricks.com/apps/j-shorttermagent?o=2850744067564480

Also updated the quickstart.sh script to populate lakebase as environment variable

Example local testing:

curl -X POST http://localhost:8000/invocations \
    -H "Content-Type: application/json" \
    -d '{"input": [{"role": "user", "content": "Hello I live in SF!"}]}'

output from above:

{"object":"response","output":[{"type":"message","id":"lc_run--019b00bc-da08-74b0-a3d3-923b4a4e002f","content":[{"text":"Hello! It's great to meet someone from San Francisco! 🌉 \n\nSF is such a vibrant city with so much to offer - from the Golden Gate Bridge and Alcatraz to the diverse neighborhoods, amazing food scene, and beautiful views. \n\nIs there anything specific you'd like to know or talk about regarding San Francisco, or anything else I can help you with today?","type":"output_text"}],"role":"assistant"}],"custom_outputs":{"thread_id":"16da732c-0bed-4525-a194-6c9759bcdf27"}}

Follow-up asking statefulness:

curl -X POST http://localhost:8000/invocations \
    -H "Content-Type: application/json" \
    -d '{
        "input": [{"role": "user", "content": "What did we discuss?"}],
        "custom_inputs": {"thread_id": "16da732c-0bed-4525-a194-6c9759bcdf27"}
    }'

Output:

{"object":"response","output":[{"type":"message","id":"lc_run--019b00bd-9b08-7193-b678-6d1b77da88be","content":[{"text":"We just started our conversation! So far, you've told me that you live in San Francisco, and I responded with a greeting acknowledging that. \n\nThat's the extent of our discussion - this is only your second message to me. Is there something specific you'd like to talk about or any questions I can help you with?","type":"output_text"}],"role":"assistant"}],"custom_outputs":{"thread_id":"16da732c-0bed-4525-a194-6c9759bcdf27"}}
image image

seeing checkpoint tables are ready in app logs:
image

can retrieve thread id via logs:
image

ensure checkpoints are stored in lakebase:
image

image

tested via app endpoint in postman:
image
image
image

@jennsun jennsun marked this pull request as ready for review January 16, 2026 22:23
@bbqiu bbqiu self-requested a review January 17, 2026 22:27
Copy link
Contributor

@bbqiu bbqiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR looks great! thank you for working on this

please address the comments from the long term example as well in this PR

@bbqiu bbqiu merged commit 0cd1cf1 into databricks:main Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants