Documentation
¶
Overview ¶
agent package defines the interface for the agent, which is the basic unit of the pipeline or workflow. Each agent process input data and produce output data, then user can connect multiple agents to form a pipeline. The both input and output are json, with an optional desc field and a data field.
{
"desc": An optional description json object
"data": A json object
}
The data and desc json object are agent specific and should have been documented by each agent.
Index ¶
- Variables
- func NewJqAgent(qstr string) (*jq, error)
- type Agent
- type AgentFanOut
- type AgentPipe
- func (ap *AgentPipe) AddAgent(agent Agent)
- func (ap *AgentPipe) Close() error
- func (ap *AgentPipe) Execute(it iter.Seq2[[]byte, error], dict map[string]string) (iter.Seq2[[]byte, error], error)
- func (ap *AgentPipe) ExecuteOne(input []byte, dict map[string]string, yield func([]byte, error) bool) error
- type NilCloseAgent
- type NilConfigAgent
- type NilKVAgent
- type SimpleExecuteAgent
- type StringArrayAgent
- func (sa *StringArrayAgent) Execute(input iter.Seq2[[]byte, error], dict map[string]string) (iter.Seq2[[]byte, error], error)
- func (sa *StringArrayAgent) ExecuteOne(input []byte, dict map[string]string, yield func([]byte, error) bool) error
- func (sa *StringArrayAgent) SetValue(name string, value interface{}) error
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func NewJqAgent ¶
Types ¶
type Agent ¶
type Agent interface {
// Config the agent with a config file
Config(bs []byte) error
// Execute the agent with input data, return the output data and error
Execute(it iter.Seq2[[]byte, error], dict map[string]string) (iter.Seq2[[]byte, error], error)
// ExecuteOne
ExecuteOne(input []byte, dict map[string]string, yield func([]byte, error) bool) error
// Close the agent
Close() error
// Set a value
SetValue(key string, value interface{}) error
}
type AgentFanOut ¶
type AgentFanOut struct {
NilKVAgent
NilConfigAgent
Agents []Agent
}
func (*AgentFanOut) Close ¶
func (af *AgentFanOut) Close() error
func (*AgentFanOut) ExecuteOne ¶
type AgentPipe ¶
type AgentPipe struct {
NilKVAgent
NilCloseAgent
// contains filtered or unexported fields
}
type NilCloseAgent ¶
type NilCloseAgent struct {
}
func (*NilCloseAgent) Close ¶
func (na *NilCloseAgent) Close() error
type NilConfigAgent ¶
type NilConfigAgent struct {
}
func (*NilConfigAgent) Config ¶
func (na *NilConfigAgent) Config(bs []byte) error
type NilKVAgent ¶
type NilKVAgent struct {
}
func (*NilKVAgent) SetValue ¶
func (na *NilKVAgent) SetValue(key string, value interface{}) error
type SimpleExecuteAgent ¶
type SimpleExecuteAgent struct {
Self Agent
}
type StringArrayAgent ¶
type StringArrayAgent struct {
NilConfigAgent
NilCloseAgent
// contains filtered or unexported fields
}
func NewStringArrayAgent ¶
func NewStringArrayAgent(values []string) *StringArrayAgent
func (*StringArrayAgent) ExecuteOne ¶
func (*StringArrayAgent) SetValue ¶
func (sa *StringArrayAgent) SetValue(name string, value interface{}) error
Click to show internal directories.
Click to hide internal directories.