Skip to content

How to pass hardcoded dynamic messages as agent's responses in the chat history ? #695

Closed as not planned
@HG2407

Description

@HG2407

Please read this first

  • Have you read the docs?Agents SDK docs
  • Have you searched for related issues? Others may have had similar requests

Question

Suppose I have a todo tracking agent, which tracks the todo tasks of a user. Now on the first message I want to provide the list of todo tasks of the user with a properly phrased hardcoded message from my end. I also want the model to have context of these tasks. I can't add these todo tasks in the system prompt. What are my options ?

I tried doing this:

input_items.append({'role': 'assistant', 'id': "msg_MADE_UP_ID", 'content': [{'annotations': [], 'text': hardcoded_content, 'type': 'output_text'}], 'status': 'completed', 'type': 'message'})
input_items.append({"content": user_input, "role": "user"})
result = await Runner.run(current_agent, input_items, context=context)

But I get this error:

openai.NotFoundError: Error code: 404 - {'error': {'message': "Item with id 'msg_MADE_UP_ID' not found.", 'type': 'invalid_request_error', 'param': 'input', 'code': None}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestion about using the SDKstale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions