Skip to content

Use the AI SDK's native message history in the agent #9455

Description

@bobbai00

Task Summary

Before every model call, the service replaces the message history with one summary message that ends with the current dataflow. A past tool call shows only its summary and the first line of a successful result. A new tool needs its own section in the summary, and the system prompt spends 1.4 KB describing its format.

Send the model the SDK's own messages as they happen, with no summary or dataflow block, so a new tool needs no change to the context code. Each call then begins with the previous call's input, which LiteLLM's automatic prompt caching (#9589) reuses; today it reuses only the tool definitions and system prompt.

  • Run the loop as the SDK's ToolLoopAgent.
  • The model reads the workflow through two tools that cannot be disabled. get_workflow lists each operator with its properties, schemas, compilation error and whether its result is there, outdated or failed, then the links. get_operator_result returns an operator's latest result without executing it, or says it is outdated.
  • A result is outdated once its operator, or one it reads from, has changed.
  • The system prompt describes what get_workflow returns, not the summary's format.

This replaces the summary that #9244 and #9259 fix.

Task Type

  • Refactor / Cleanup
  • DevOps / Deployment / CI
  • Testing / QA
  • Documentation
  • Performance
  • Other
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions