steamship.agents package#

Subpackages#

Submodules#

steamship.agents.basic_chat module#

steamship.agents.functions_based module#

steamship.agents.logging module#

class steamship.agents.logging.AgentLogging[source]#

Bases: object

These keys are for use in the extra field of agent logging operations. #noqa: RST203

For now, they are manually applied at the time of logging. In the future, the AgentContext may provide a logger which fills some automatically.

For example:

logging.info(“I should use tool MakeAPicture”, extra={

AgentLogging.AGENT_NAME: self.name, AgentLogging.IS_AGENT_MESSAGE: True, AgentLogging.MESSAGE_TYPE: AgentLogging.THOUGHT

}) # noqa: RST203

This provides:

  • Structured additions to Fluent/Elastic that help with internal debugging.

  • Helpful output in development mode

  • [Eventual] User-visible logs

  • [Eventual] Visualiations about tool execution and ReAct reasoning

ACTION = 'action'#
AGENT = 'agent'#
AGENT_NAME = 'agent_name'#
IS_MESSAGE = 'is_message'#
LLM = 'llm'#
LLM_NAME = 'llm_name'#
MESSAGE = 'message'#
MESSAGE_AUTHOR = 'message_author'#
MESSAGE_TYPE = 'agent_message_type'#
OBSERVATION = 'observation'#
PROMPT = 'prompt'#
SYSTEM = 'system'#
THOUGHT = 'thought'#
TOOL = 'tool'#
TOOL_NAME = 'tool_name'#
USER = 'user'#
class steamship.agents.logging.StreamingOpts(*, include_agent_messages: bool = True, include_llm_messages: bool = True, include_tool_messages: bool = True)[source]#

Bases: BaseModel

Controls what status messages for a given AgentService invocation should be included in the resultant stream.

include_agent_messages: bool#

Whether or not to include agent-generated messages in the ChatHistory stream.

Agent messages are any logging messages with: AgentLogging.MESSAGE_AUTHOR == AgentLogging.AGENT. These typically are status messages logged in either the AgentService or the Agent code.

NOTE: Agent status messages include “request complete” signal messages for streaming use cases. Disabling these messages will impact streaming generator function.

include_llm_messages: bool#

Whether or not to include LLM-generated messages in the ChatHistory stream.

LLM messages are any logging messages with: AgentLogging.MESSAGE_AUTHOR == AgentLogging.LLM. These typically are status messages logged in LLM code (ex: ChatOpenAI).

include_tool_messages: bool#

Whether or not to include Tool-generated messages in the ChatHistory stream.

LLM messages are any logging messages with: AgentLogging.MESSAGE_AUTHOR == AgentLogging.TOOL. These typically are status messages logged in Tool code (ex: GeneratorTool).

property stream_intermediate_events#

steamship.agents.utils module#

steamship.agents.utils.build_chat_history(default_system_message: str, message_selector: MessageSelector, context: AgentContext) List[Block][source]#
steamship.agents.utils.get_llm(context: AgentContext, default: LLM | None = None) LLM | None[source]#

Retrieves the LLM from the provided AgentContext (if it exists).

steamship.agents.utils.with_llm(llm: LLM, context: AgentContext | None = None) AgentContext[source]#

Sets an LLM for general purpose lookup and usage on an AgentContext.

Module contents#