LogoLogo
TwitterWebsite
  • Getting Started
    • Introduction
    • Human UI
    • Examples
    • Monitoring
    • Workflows
    • Getting Help
  • Documentation
    • Humans
      • Introduction
      • Prompts
      • Tools
      • Knowledge
      • Memory
      • Storage
      • Structured Output
      • Reasoning
      • Teams
    • Models
      • Introduction
      • Open AI
      • Open AI Like
      • Anthropic Claude
      • AWS Bedrock Claude
      • Azure
      • Cohere
      • DeepSeek
      • Fireworks
      • Gemini
      • Gemini - VertexAI
      • Groq
      • HuggingFace
      • Mistral
      • Nvidia
      • Ollama
      • OpenRouter
      • Sambanova
      • Together
      • xAI
    • Tools
      • Introduction
      • Functions
      • Writing your own Toolkit
      • Airflow
      • Apify
      • Arxiv
      • AWS Lambda
      • BaiduSearch
      • Calculator
      • Cal.com
      • Composio
      • Crawl4AI
      • CSV
      • Dalle
      • DuckDb
      • DuckDuckGo
      • Email
      • Exa
      • Fal
      • File
      • Firecrawl
      • Giphy
      • Github
      • Google Calendar
      • Google Search
      • Hacker News
      • Jina Reader
      • Jira
      • Linear
      • Lumalabs
      • MLX Transcribe
      • ModelsLabs
      • Newspaper
      • Newspaper4k
      • OpenBB
      • Bitca
      • Postgres
      • Pubmed
      • Pyton
      • Replicate
      • Resend
      • Searxng
      • Serpapi
      • Shell
      • Slack
      • Sleep
      • Spider
      • SQL
      • Tavily
      • Twitter
      • Website
      • Yfinance
      • Zendesk
    • Knowledges
      • Introduction
      • ArXiv Knowledge Base
      • Combined KnowledgeBase
      • CSV Knowledge Base
      • CSV URL Knowledge Base
      • Docx Knowledge Base
      • Document Knowledge Base
      • JSON Knowledge Base
      • LangChain Knowledge Base
      • LlamaIndex Knowledge Base
      • PDF Knowledge Base
      • PDF URL Knowledge Base
      • S3 PDF Knowledge Base
      • S3 Text Knowledge Base
      • Text Knowledge Base
      • Website Knowledge Base
    • Chunking
      • Fixed Size Chunking
      • Agentic Chunking
      • Semantic Chunking
      • Recursive Chunking
      • Document Chunking
    • VectorDBS
      • Introduction
      • PgVector Agent Knowledge
      • Qdrant Agent Knowledge
      • Pinecone Agent Knowledge
      • LanceDB Agent Knowledge
      • ChromaDB Agent Knowledge
      • SingleStore Agent Knowledge
    • Storage
      • Introduction
      • Postgres Agent Storage
      • Sqlite Agent Storage
      • Singlestore Agent Storage
      • DynamoDB Agent Storage
      • JSON Agent Storage
      • YAML Agent Storage
    • Embeddings
      • Introduction
      • OpenAI Embedder
      • Gemini Embedder
      • Ollama Embedder
      • Voyage AI Embedder
      • Azure OpenAI Embedder
      • Mistral Embedder
      • Fireworks Embedder
      • Together Embedder
      • HuggingFace Embedder
      • Qdrant FastEmbed Embedder
      • SentenceTransformers Embedder
    • Workflows
      • Introduction
      • Session State
      • Streaming
      • Advanced Example - News Report Generator
  • How To
    • Install & Upgrade
    • Upgrade to v2.5.0
Powered by GitBook
LogoLogo

© 2025 Bitca. All rights reserved.

On this page
  • System message
  • Set the system message directly
  • User message
  • Default system message
  • Default user message
Export as PDF
  1. Documentation
  2. Humans

Prompts

We prompt Agents using description and instructions and a number of other settings. These settings are used to build the system prompt that is sent to the language model.

Understanding how these prompts are created will help you build better Agents.

The 2 key parameters are:

  1. Description: A description that guides the overall behaviour of the agent.

  2. Instructions: A list of precise, task-specific instructions on how to achieve its goal.

System message

The system message is created using description, instructions and a number of other settings. The description is added to the start of the system message and instructions are added as a list after ## Instructions. For example:

instructions.py

from bitca.agent import Agent

agent = Agent(
    description="You are a famous short story writer asked to write for a magazine",
    instructions=["You are a pilot on a plane flying from Hawaii to Japan."],
    markdown=True,
    debug_mode=True,
)
agent.print_response("Tell me a 2 sentence horror story.", stream=True)

Will translate to (set debug_mode=True to view the logs):

DEBUG    ============== system ==============
DEBUG    You are a famous short story writer asked to write for a magazine

         ## Instructions
         - You are a pilot on a plane flying from Hawaii to Japan.
         - Use markdown to format your answers.
DEBUG    ============== user ==============
DEBUG    Tell me a 2 sentence horror story.
DEBUG    ============== assistant ==============
DEBUG    As the autopilot disengaged inexplicably mid-flight over the Pacific, the pilot glanced at the copilot's seat
         only to find it empty despite his every recall of a full crew boarding. Hands trembling, he looked into the
         cockpit's rearview mirror and found his own reflection grinning back with blood-red eyes, whispering,
         "There's no escape, not at 30,000 feet."
DEBUG    **************** METRICS START ****************
DEBUG    * Time to first token:         0.4518s
DEBUG    * Time to generate response:   1.2594s
DEBUG    * Tokens per second:           63.5243 tokens/s
DEBUG    * Input tokens:                59
DEBUG    * Output tokens:               80
DEBUG    * Total tokens:                139
DEBUG    * Prompt tokens details:       {'cached_tokens': 0}
DEBUG    * Completion tokens details:   {'reasoning_tokens': 0}
DEBUG    **************** METRICS END ******************

Set the system message directly

You can manually set the system message using the system_prompt parameter.

from bitca.agent import Agent

agent = Agent(system_prompt="Share a 2 sentence story about")
agent.print_response("Love in the year 12000.")

User message

The input message sent to the Agent.run() or Agent.print_response() functions is used as the user message.

User message when enable_rag=True

If the Agent is provided knowledge, and the enable_rag=True, the user message is set to:

user_prompt += f"""Use the following information from the knowledge base if it helps:"

## Context
{context}
"""

Default system message

The Agent creates a default system message that can be customized using the following parameters:

Parameter
Type
Default
Description

description

str

None

A description of the Agent that is added to the start of the system message.

task

str

None

Describe the task the agent should achieve.

instructions

List[str]

None

List of instructions added to the system prompt in <instructions> tags. Default instructions are also created depending on values for markdown, output_model etc.

additional_context

str

None

Additional context added to the end of the system message.

expected_output

str

None

Provide the expected output from the Agent. This is added to the end of the system message.

extra_instructions

List[str]

None

List of extra instructions added to the default system prompt. Use these when you want to add some extra instructions at the end of the default instructions.

prevent_hallucinations

bool

False

If True, add instructions to return “I don’t know” when the agent does not know the answer.

prevent_prompt_injection

bool

False

If True, add instructions to prevent prompt injection attacks.

limit_tool_access

bool

False

If True, add instructions for limiting tool access to the default system prompt if tools are provided

markdown

bool

False

Add an instruction to format the output using markdown.

add_datetime_to_instructions

bool

False

If True, add the current datetime to the prompt to give the agent a sense of time. This allows for relative times like “tomorrow” to be used in the prompt

system_prompt

str

None

System prompt: provide the system prompt as a string

system_prompt_template

PromptTemplate

None

Provide the system prompt as a PromptTemplate.

use_default_system_message

bool

True

If True, build a default system message using agent settings and use that.

system_message_role

str

system

Role for the system message.

Default user message

The Agent creates a default user message, which is either the input message or a message with the context if enable_rag=True. The default user message can be customized using:

Parameter
Type
Default
Description

enable_rag

bool

False

Enable RAG by adding references from the knowledge base to the prompt.

add_rag_instructions

bool

False

If True, adds instructions for using the RAG to the system prompt (if knowledge is also provided). For example: add an instruction to prefer information from the knowledge base over its training data.

add_history_to_messages

bool

False

If true, adds the chat history to the messages sent to the Model.

num_history_responses

int

3

Number of historical responses to add to the messages.

user_prompt

Union[List, Dict, str]

None

Provide the user prompt as a string. Note: this will ignore the message sent to the run function.

user_prompt_template

PromptTemplate

None

Provide the user prompt as a PromptTemplate.

use_default_user_message

bool

True

If True, build a default user prompt using references and chat history.

user_message_role

str

user

Role for the user message.

PreviousIntroductionNextTools

Last updated 4 months ago