Package-level declarations
Types
A GraphObserver that is also told about the calls to models and tools inside the nodes of a run and in the conditions of its edges: those of toolLoop and toolAgent, of chatWithProgress, of ask (each time it asks), of a ChatDecisionModel, also in a decisionEdge, and of execute. Each call says which caller made it: an ObservedNode, or an ObservedEdge for the condition of an edge. Use it to count the tokens of a run, log which tools ran, or show them in a debugger. Give it to a run in GraphConfig.observers, like any observer:
The state of a toolAgent: the conversation so far, oldest message first, and what it cost.
What a DecisionModel answered to one Question.
A task that a supervisor gave to one of its agents, and the work the agent did on it.
A file that goes to a model with a message, such as the photo of a receipt or a contract as a PDF.
A DecisionModel that asks a ChatModel, so that choose, isYes, score and decisionEdge work with the model an app already has: Claude, OpenAI, Gemini, Ollama, or any other.
What a ChatModel emits while it writes an answer. See ChatModel.stream.
One message of a conversation with a ChatModel.
A call to a ChatModel failed: the provider could not be reached, it returned an error, or the model declined to answer.
What a ChatModel is asked.
What a ChatModel answered.
An AgentObserver that is also told what the calls send and get back: the request a model is sent, its answer, the input of a tool and its result. Use it to record the conversation in a trace, as OtlpObserver and OpenTelemetryObserver of telar-otel do with recordContent = true:
A model that decides instead of writing: it picks one of the options you give it, answers yes or no, or rates something on a scale, and says how sure it is. Such a model is fast and cheap, and its answer has a fixed type, which makes it a good fit for the places where a graph has to decide: which node comes next, whether an answer is good enough, whether a person has to look.
A call to a DecisionModel failed: the provider could not be reached, it returned an error, or its answer does not fit the question.
What a DecisionModel is asked.
What a DecisionModel answered.
A model that turns texts into vectors, so that texts that mean the same have vectors that point the same way. SemanticStore uses one to find what a query is about. It is the interface for every provider, as ChatModel is for chat: OpenAiEmbeddingModel of telar-openai reaches OpenAI, Ollama, Gemini and every server with the embeddings API of OpenAI.
A call to an EmbeddingModel failed: the provider could not be reached, or it returned an error.
A call to a model that an AgentObserver is told about. It is the same object from the start of the call to its end.
A call to a tool that an AgentObserver is told about. It is the same object from the start of the call to its end.
A question to a DecisionModel. Its kind decides the kind of Answer.
A Store whose search finds the items that a query means, with the vectors of an EmbeddingModel: "what does she eat?" finds "Piscivegetarian: fish, but no meat", which has none of its words. Everything else goes to store as it is.
A function a model may call that reads the state of the run and changes it: add a line to an order, book a seat, move a piece. What it did is in the state, so a checkpoint holds it and the next node sees it.
An agent of a team: what it is good at, and the model, tools and instructions it works with.
The state of a supervisor: its conversation with the user and the work of its agents.
The tokens a call to a ChatModel read (inputTokens) and wrote (outputTokens), or those of several calls added up. TokenUsage() is no tokens, the start of a count:
What a StateTool did.
What ask returns for a ChatRequest.
Properties
The piece of text a model wrote, when this event is a node's report of one, and null for every other event. toolLoop and chatWithProgress report these. A report from inside a subgraph is read as well.
Functions
Returns the model's next message for request as an instance of the @Serializable class Answer, with the message it was read from. Use it to ask for a value at the end of a conversation. See the overload with a prompt for how the model is asked.
Returns the model's next message for request as a value read with serializer. See the overload with a reified type.
Adds attachment to the result of the tool call that runs this code, so the model gets the file with the text the tool returns: the screenshot that a browser tool took, for example.
Sends prompt as a single user message and returns the text of the answer, for a node that only needs a piece of text from the model. Call ChatModel.chat with a ChatRequest when you need to know whether the answer was cut off.
Returns the model's next message for request, like ChatModel.chat, and lets a streamed run watch the model write it. Use it in a node in place of ChatModel.chat:
Sends prompt as a single user message and returns the text of the answer, like chat with a prompt, and lets a streamed run watch the model write it. See the overload with a ChatRequest.
Asks which constant of the enum Option fits state. The model sees the names of the constants, and for each one the text that describe returns. Read the constant from the answer with value.
Adds a conditional edge from from on which a DecisionModel picks the next node: a router that understands language, at the speed and price of a decision model.
Returns a graph that is a team of agents who hand the conversation to each other: the first of agents answers, and each agent can end its turn by handing the conversation to another, which goes on from there.
Asks a yes/no question about state. Read Answer.YesNo.isYes, or compare Answer.YesNo.probability with a line of your own.
Returns the tool calls of the last assistant message that have no ChatMessage.ToolResult yet.
Creates a StateTool for a graph with the state State, whose input is the @Serializable type Input. The input schema is built from the type as for a Tool. Use StateTool<State, Unit> for a tool that takes no input.
Creates a StateTool whose input is read with serializer. See the overload with a reified type.
Returns a graph that is a team of agents with a supervisor: model reads the task, gives each part to the agent that fits it, reads what comes back, and answers when the task is done.
Creates a Tool whose input is the @Serializable type Input. The input schema is built from the type, with the text of Description annotations as the description of each property.
Creates a Tool whose input is the @Serializable type Input, for a tool that does something that must not happen twice, such as a payment.
Creates a Tool whose input is read with serializer. See the overload with a reified type.
Creates a Tool with a reconcile whose input is read with serializer. See the overload with a reified type.
Adds the loop of a tool-calling agent to this graph and returns its first node.